How would keep a context menu from disappearing?

Class library usage, coding and language questions.
chall
Posts: 15
Joined: Mon Aug 20, 2007 4:15 pm

How would keep a context menu from disappearing?

Post by chall » Thu Sep 06, 2007 4:05 pm

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?

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Thu Sep 06, 2007 4:46 pm

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

chall
Posts: 15
Joined: Mon Aug 20, 2007 4:15 pm

Post by chall » Thu Sep 06, 2007 5:08 pm

That did it, thanks!