LEADTOOLS Support
Document
Document SDK Questions
Re: Trouble adding second annotation using automation
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Monday, January 19, 2009 5:46:14 AM(UTC)
Groups: Registered
Posts: 47
Hi,
I am just getting started using automation. Using the VBAutomationDemo included in the example files as a model I have been able to add annotation features our software. I can create the toolbar with _automationManager.CreateToolBar() and add one annotation to an image that the application is displaying. However, I can't add a second annotation. I perform the following steps:
- Create the first annotation
- Click on an annotation object in the annoation toolbar
- Click in the main image to add the second annotation
The cursor does not change when I click in the image, and no annotation object appears in the image when I click/drag.
However, if I do the following then I can add a second annotation -
- Create the first annotation
- Click on an annotation object in the annoation toolbar
- Switch to a different window using Alt-Tab
- Return to my application
- Click in the main image to add the second annotation
The cursor does change, and I can add the second annotation!!
There must be something that I am neglecting to do or not understanding. Any help would be appreciated. We are using LEAD version 15 (Leadtools.dll version = 15.0.1.0) with VS2008 - VB.
Thank you,
John
#2
Posted
:
Monday, January 19, 2009 11:40:24 AM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hello John,
Your dlls are fairly old, but I don't think that is the cause of this particular problem. However, if you'd like to get the latest v15 dlls, please send an email to support with the following information so I can send you the latest dlls:
1. The company you work for
2. The LEADTOOLS serial number(s) you own (if you are evaluating, just say so)
3. The name(s) of the developer(s) using the serial number
4. A link to this forum post
Regarding this particular problem, it appears that repainting the application is all you need to do to add the second annotation. To do this programmatically, call Invalidate() on the form or the RasterImageViewer so that Windows will repaint it.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
#3
Posted
:
Monday, January 19, 2009 12:01:55 PM(UTC)
Groups: Registered
Posts: 47
Walter -
Where would I add the Invalidate() call? I tried adding an ItemAdded event handler and adding the invalidate call to the event handler. That didn't seem to work. Where else would I add the event handler? Are there any events that fire when the user clicks on the annotation toolbar? Also, I don't see any calls to Invalidate() being made in the VBAutomationDemo app in between annotations, and it seems to be working fine.
My code to initialize the automation manager looks something like this:
_automationManager = New AnnAutomationManager
_automationManager.RasterCodecs = _codecs
' enable 14.5 new XP style toolbar -- must be called CreateDefaultObjects();
_automationManager.UseXPStyleToolBar = True
_automationManager.CreateDefaultObjects()
_automationManager.CreateToolBar()
_automationManager.ToolBar.Dock = DockStyle.Bottom
_automationManager.ToolBar.BringToFront()
_automationManager.ToolBar.AutoSize = True
_automationManager.ToolBar.Appearance = ToolBarAppearance.Flat
_automationManager.MaintainAspectRatio = True
_automationManager.UserMode = AnnUserMode.Design
' There is one RasterImageViewer in my app called mainImage
_automation = New AnnAutomation(_automationManager, mainImage)
' I added the mainImage.invalidate() call to the annotationItemAddedOrRemoved function
AddHandler _automation.Container.Objects.ItemAdded, AddressOf annotationItemAddedOrRemoved
AddHandler _automation.Container.Objects.ItemRemoved, AddressOf annotationItemAddedOrRemoved
I will send the email for the updates. Thank you -
John
#4
Posted
:
Tuesday, January 20, 2009 12:54:59 PM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
John,
It may not be necessary - but from what you described, it sounded like what you needed. It's difficult for me to tell from this sample code what else might be missing in order for this to work.
Is this code in a small sample project? If so, could you post it so I can take a look at it and try to modify it?
Here are some guidelines:
NOTE: If you are attaching a project or file to the forums...
1.) Zip the file(s) up.
2.) Make sure it is less than 5 MB. If it is larger, please send an email to
support@leadtools.com and we'll send you FTP instructions.
3.) Remove ANY AND ALL unlock codes and LEADTOOLS DLLs.
4.) Do not click the preview button, the attachment will not show up when you post it.
If you do not wish to post your file(s) on the forum since they are publically viewable, please send an email to
support@leadtools.com and make sure that you include a link to this forum post.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
#5
Posted
:
Tuesday, January 20, 2009 5:19:05 PM(UTC)
Groups: Registered
Posts: 47
Walter - I put together a simple example that demonstrates my problem. Please see the attached project. Thank you for looking into this.
- John
#6
Posted
:
Wednesday, January 21, 2009 8:24:10 AM(UTC)
Groups: Registered
Posts: 47
FYI - I installed the LEAD updates, cleaned and rebuilt my test project, but am still getting the same results.
#7
Posted
:
Friday, January 23, 2009 12:58:07 PM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hello John,
Sorry about the delay in my response. I'm still looking over your project. I'll post back as soon as I have any information about it.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
#8
Posted
:
Monday, January 26, 2009 7:33:21 AM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hello John,
I added the following line in your InitAutomation method, and I could not reproduce the issue any longer.
_automation.Active = True
Please try this and tell me if you can still reproduce this issue. If so, please give me more detailed information regarding which annotations you're selecting and any mouse clicks you're doing which will allow me to see the issue.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
#9
Posted
:
Monday, January 26, 2009 8:33:03 AM(UTC)
Groups: Registered
Posts: 47
Walter -
That does the trick - thank you! I didn't notice that the _automation.Active = true was in the mdi child form activate in the sample project.
- John
#10
Posted
:
Monday, January 26, 2009 9:03:47 AM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
I'm glad that fixed the problem.
Another resource you can check out is the help file topic "Working with Automated Annotation". You can find the help file topic locally, or in our online documentation here:
http://www.leadtools.com/Help/LEADTOOLS/v16/DH/TO/Leadtools.Topics~Leadtools.Topics.WorkingWithAutomatedAnnotations.html
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Document
Document SDK Questions
Re: Trouble adding second annotation using automation
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.