Unable to select a drodown list item

Ask general questions here.
sahoko
Posts: 9
Joined: Tue Oct 09, 2007 5:07 pm

Unable to select a drodown list item

Post by sahoko » Sat Jan 05, 2008 1:55 am

AUT: Windows app written in Delphi using DevExpress for UI controls

I recorded the action, and the recorder produced the code below. It replays fine. However when I try to do the same thing in my test code, the dropdown list closes right after it's clicked, and my test code fails to click a drodown list item:

Code generated by the recorder:
// Find child by class name
control = form.FindClassName("TomLookupCachedCombo", 5);
control.Focus();
Mouse.ClickControl(control, MouseButtonType.LeftButton, new Point(159, 9), 1, 100);

//-----------------------------------------------------------------
// Find form by title and class name
//-----------------------------------------------------------------
form = Application.FindForm("", SearchMatchMode.MatchExact, "ComboLBox", false, 5000);
formElement = form.Element;

// Find child element by Role=ListItem Name=DIR - Direct Business
element = formElement.FindChild(Role.ListItem, "DIR - Direct
Business", null);

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Mon Jan 07, 2008 11:31 am

Unfortunately I cannot reproduce the problem with the standard Win32 or .NET comboboxes.
From your code, it looks like the Recorder tries to click your combobox control directly to open it.
Try using the Spy to check if the dropdown button on the combobox is available as an element, and then click the element instead of the control.

If that doesnt work please build a mini-example binary, and mail it to [email protected], as we dont use Delphi.

Michael
Ranorex Support Team

sahoko
Posts: 9
Joined: Tue Oct 09, 2007 5:07 pm

Post by sahoko » Mon Jan 07, 2008 6:29 pm

The spy tells me that the element has the role type of "Client". This element doesn't have a default action associated with it. Is there a function to click this element without any default action?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Tue Jan 08, 2008 10:31 am

It looks like the Delphi combobox is owner-drawn, and that there is a problem with the focus after clicking the control, because the drop-down is an independent top-level window.

If you could send us a sample application where this problem occurs, we can try to figure out whats wrong.

Michael
Ranorex Support Team

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

DevExpress Combobox

Post by Support Team » Fri Jan 11, 2008 11:47 am

I finally checked the DevExpress Delphi controls and it seems that most drop-down or combo boxes create client areas, where no further elements are available.

In your example, after clicking the combo box to open the popup, try using the following code, instead of clicking the element:

Code: Select all

 
form = Application.FindFormClassName("TcxComboBoxPopupWindow");
Mouse.ClickControl(form, MouseButtonType.LeftButton, new Point(10,10));
(where Point(x,y) can be any coordinates within the popup window.)

If that does not solve your problems, as a workaround when using comboboxes containing text I suggest using sendkey commands for selecting text, or using arrow up/down for traversing the list.

Michael
Ranorex Support Team