Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, October 31, 2006 2:30:24 PM(UTC)

cmurphy  
cmurphy

Groups: Registered
Posts: 31


If user right click and it brings up annotation menu, how can I track which menu item user selected?

I've debug code display list (see below) and detail of each menu item in the OnAnnMenu() but I didn't see anything that would give me a clue which menu item user selected - i.e. I've seleted "Undo":

[0] text=&Undo, ID=115, enable=True, checked=False
[1] text=Cu&t, ID=100, enable=True, checked=False
[2] text=&Copy, ID=101, enable=True, checked=False
[3] text=&Paste, ID=102, enable=True, checked=False
[4] text=&Delete, ID=103, enable=True, checked=False
[5] text=, ID=-1, enable=False, checked=False
[6] text=Select &All, ID=114, enable=True, checked=False
[7] text=, ID=-1, enable=False, checked=False
[8] text=Bring to &Front, ID=104, enable=True, checked=False
[9] text=Send to &Back, ID=105, enable=True, checked=False
[10] text=, ID=-1, enable=False, checked=False
[11] text=&Lock All..., ID=118, enable=True, checked=False
[12] text=&Unlock All..., ID=119, enable=True, checked=False
[13] text=, ID=-1, enable=False, checked=False
[14] text=Default Pr&operties, ID=0, enable=True, checked=False

private void OnAnnMenu(int hMenu)
{
    LTANNLib.LEADRasterAnnMenu annMenu = new LTANNLib.LEADRasterAnnMenu();
    annMenu.SetAnnMenu(hMenu);
    Console.WriteLine("OnAnnMenu(): hMenu=" + hMenu);

    annMenu.EnableMethodErrors = false;

    try
    {
        string szout = "There are " + annMenu.Count + " Items";
        Console.WriteLine(szout);
        for (short i = 0; i < annMenu.Count; i++)
        {
            LTANNLib.AnnMenuItemTypeConstants mnuType = new LTANNLib.AnnMenuItemTypeConstants();
            mnuType = (LTANNLib.AnnMenuItemTypeConstants)annMenu.get_ItemType(i);
            string mnuText = "";
            int mnuID = -1;
            bool mnuEnable = false;
            bool mnuChecked = false;
            if (mnuType != LTANNLib.AnnMenuItemTypeConstants.ANN_MENUITEMTYPE_SEPARATOR)
            {
                mnuText = "" + annMenu.get_ItemString(i);
                mnuID = (int)annMenu.get_ItemID(i);
                mnuEnable = (bool)annMenu.get_ItemEnabled(i);
                mnuChecked = (bool)annMenu.get_ItemChecked(i);
            }
            Console.WriteLine("[" + i + "] text=" + mnuText + ", ID=" + mnuID
                + ", enable=" + mnuEnable + ", checked=" + mnuChecked);
        }
 }
 catch (System.Exception ex)
 {
  throw ex;
 }
}

Please help,

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, November 1, 2006 5:39:58 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)


This only can be done to the menu items created by the user,
not the LEADTOOLS built-in menu. When you create your own annotation menu
items, use the OnAnnUserMenu event to return the ID of the menu item has been clicked.

 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.064 seconds.