PushButton - how can I select an item from the dropdown list

Class library usage, coding and language questions.
sahoko
Posts: 9
Joined: Tue Oct 09, 2007 5:07 pm

PushButton - how can I select an item from the dropdown list

Post by sahoko » Thu Oct 11, 2007 7:56 pm

I can open the dropdown list using this code fine:

foreach (Control control in _form.Controls)
{
Element objDropDown = control.Element.FindChild(role, name, className, location);
if (objDropDown != null)
{
// click the dropdown list
objDropDown.DoDefaultAction();
rc = 0;
break;
}
}

After the list is open, I don't know how to select an item. I don't know how to use the spy to get the info on the dropdown items since the dropdown list closes as soon as I activate the spy.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Post by Support Team » Thu Oct 11, 2007 9:45 pm

I don't know how to use the spy to get the info on the dropdown items since the dropdown list closes as soon as I activate the spy.
If you enable the HotTracker, you can also check menus and popup menus with the Spy.

You can use the function PopupMenuSelectItem() or ContextMenu.SelectItemText() for selecting a menu item in a popup menu.

Jenö
Ranorex Support Team