Page 1 of 1

How would keep a context menu from disappearing?

Posted: Thu Sep 06, 2007 4:05 pm
by chall
I am trying to make a menu selection using the following code:

Ranorex.Menu menu = new Ranorex.Menu(form);

string[] menuItems = itemName.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

int numOfMenuItems = menuItems.Length;
for (int i=0; i<numOfMenuItems; i++) {
if (i==0) {
menu.SelectItemText(menuItems);
}
else {
Ranorex.ContextMenu.SelectItemText(menuItems);
}
}

Sometimes, the code works fine and each menu option is selected; then there are times when the context menu disappears and the last option is not selected. It appears the path of the mouse movement is causing the context menu to disappear; and I don't know how to prevent that from happening.

Do you have any ideas?

Posted: Thu Sep 06, 2007 4:46 pm
by webops
Please try the the following:

Code: Select all

ContextMenu.SelectItemText("ContextMenuSubmenu1", "SubSubMenu1", "SubSubItem1");
See also the sample "RanorexVS2005Sample3.exe" in the Samples directory.

Jenö
Ranorex Team

Posted: Thu Sep 06, 2007 5:08 pm
by chall
That did it, thanks!