Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Loading only Wang supported annotations in the toolbar
Started by jigar at 09-05-2008 13:27. Topic has 17 replies.

Print Search « Previous Thread Next Thread »
  09-05-2008, 13:27
jigar is not online. Last active: 11/19/2008 5:21:33 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 453
Re: Loading only Wang supported annotations in the toolbar
Reply Quote
I'll answer your second question first.  You cannot create the toolbar first and then add the buttons.  You have to add them before calling CreateToolbar().  If you don't want to remove the buttons then you can create just the buttons you want manually, and in this case you should not call CreateDefaultObjects().

Now the reason why it's not removing some of the objects is because it keeps on incrementing the idx value when an object is removed.  To give a small example, lets say you have a list, and you have 3 objects inside: A, B, and C.  The Count value for the list is 3.  Let's say you want to remove B and C from the list.  If you remove the item at index 1, then you are left with A, C.  Since you removed an item you don't want to increment the position to the next element because the list has gotten shorter (Count = 2).

So change your for loop to this:

            for (int idx = 0; idx < annMgr.Objects.Count; /* see code in else statment below */ )
            {
                annAutoObj = annMgr.Objects[idx];
                if ((annAutoObj.Id == AnnAutomationManager.RulerObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.PolyRulerObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.ProtractorObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.StampObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.AudioObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.ButtonObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.CrossProductObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.HotspotObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.FreehandHotspotObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.PointObjectId) ||
                        (annAutoObj.Id == AnnAutomationManager.RubberStampObjectId)
                    )
                {
                    annMgr.Objects.Remove(annAutoObj);
                }
                else
                {
                    // Only increment if we DON'T remove an object.
                    idx++;
                }
            }


LEADTOOLS Technical Support
   Report 
  09-05-2008, 23:45
roadman is not online. Last active: 9/26/2008 5:05:06 PM roadman

Top 25 Posts
Joined on 06-27-2007
Posts 95
Re: Loading only Wang supported annotations in the toolbar
Reply Quote
Thank for your detailed explaination!

Do you mean that i have to add my button manually same as the "CreateMyAutomationObjects" in the example of the AnnAutomationManager?

It seem that it needs a number of steps to setup the button's appearance.
e.g // set up the line automation object ....

Is there any defaulted button so that i don't need to setup
   Report 
  09-08-2008, 12:34
jigar is not online. Last active: 11/19/2008 5:21:33 PM jigar



Top 10 Posts
Joined on 08-22-2007
Posts 453
Re: Loading only Wang supported annotations in the toolbar
Reply Quote
No, we don't have any default buttons.  Our CreateDefaultObjects() does the same thing internally as the CreateMyAutomationObjects example.  So you just have to follow that example.

LEADTOOLS Technical Support
   Report 
Post
 Page 2 of 2 (18 items) « 1 2
LEAD Support Fo... » Developer » Annotations » Loading only Wang supported annotations in the toolbar

Powered by Community Server, by Telligent Systems