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,