How do I get the AnnotationIdx of a newly created annot?
How do I get the AnnotationIdx of a newly created annot?
Hi, I'm writing an application where I let the user create an arrow, I then catch the AnnotationAddedByUser event and add a TextAnnotation (with an annotationManager) that is supposed to be linked or grouped with the arrow such that if the arrow is moved or resized, the text annotation is also moved. The problem is I can't get a handle to the text annotation I created with the annotation manager. I'm trying to find a way to get the AnnotationIdx at the time the text annotation is created, but I can't find it.
I also tried adding the annotationtext to an array and then recover it and edit it, it does change it in the array but not in the gdViewer.
Any help would be greatly appreciated.
Thanks.
I also tried adding the annotationtext to an array and then recover it and edit it, it does change it in the array but not in the gdViewer.
Any help would be greatly appreciated.
Thanks.
Re: How do I get the AnnotationIdx of a newly created annot?
Hello,
The AnnotationIdx parameter is an index between 0 and Annotation count - 1. Therefore, the annotation index of the latest added annotation is equal to the number of annotations less 1.
If you are sill not able to do what you are trying to achieve, just write a code snippet and I will provide some guidance.
Kind regards,
Loïc
The AnnotationIdx parameter is an index between 0 and Annotation count - 1. Therefore, the annotation index of the latest added annotation is equal to the number of annotations less 1.
If you are sill not able to do what you are trying to achieve, just write a code snippet and I will provide some guidance.
Kind regards,
Loïc
Re: How do I get the AnnotationIdx of a newly created annot?
I found a way of doing it, it would be awesome if the gdviewer had an annotations collection exposed to the programmer. Also, it would be very helpful if the annotations had an Id in addition to the index so that we can reference them directly instead of having to search for it everytime we need to do something with one specific annotation. In this scenario, we can't use the index because the index can change if an annotation is deleted....
All in all, it's a great tool, great job!!!
All in all, it's a great tool, great job!!!
Re: How do I get the AnnotationIdx of a newly created annot?
Hello,
IE:
Kind regards,
Loïc
Hey, have a look here: https://www.gdpicture.com/whats-new-v9.phpit would be awesome if the gdviewer had an annotations collection exposed to the programmer.
GdViewer: new method GetAnnotationManager(). (BETA 9.0.3)
There is no sense for that. Since you can get each annotation objects.Also, it would be very helpful if the annotations had an Id in addition to the index
If you get the annotation object there is no problem.In this scenario, we can't use the index because the index can change if an annotation is deleted....
IE:
Code: Select all
Annotation annot = AnnotationManager.GetAnnotationFromIdx(Idx);
Thank you! We'll publish the V9 soon. It we be even more betterAll in all, it's a great tool, great job!!!
Kind regards,
Loïc
Who is online
Users browsing this forum: No registered users and 2 guests