Dev Express ComboBox

Class library usage, coding and language questions.
atom
Posts: 357
Joined: Sun Dec 07, 2008 11:14 pm
Location: Dublin, Ireland

Dev Express ComboBox

Post by atom » Mon Apr 18, 2011 4:09 pm

Hiya

I have a control of type:

DevExpress.XtraEditors.ComboBoxEdit

But Ranorex Spy see's this as two controls:

- Text
- Button

Why can't it map it to Ranorex.ComboBox ?

Thanks

atom
Posts: 357
Joined: Sun Dec 07, 2008 11:14 pm
Location: Dublin, Ireland

Re: Dev Express ComboBox

Post by atom » Mon Apr 18, 2011 4:10 pm

It means I have to write my own wrapper to Invoke Remotely to do the most basic things like:

- Get list of items in combo box
- Select an item

Thanks

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Dev Express ComboBox

Post by Ciege » Mon Apr 18, 2011 4:38 pm

We also use the same DevExpress combos in our AUT, but you do not need to use InvokeRemotely to access the information within them. But it does take just a little bit of work.

What I do in my ComboSelect method is (with error checking and logging removed for brevity):

1) Find the Combo then it's associated Open button

Code: Select all

HDComboBox = RanorexFormName.FindSingle(".//combobox[@controlname='" + ComboBoxName + "' or @text='" + ComboBoxName + "' or @controlid='" + ComboBoxName + "']", 60000);
HDComboOpenButton = HDComboBox.FindSingle("button[@accessiblename='Open']", 30000);
2) Open the Combo by clicking the Open button

Code: Select all

HDComboOpenButton.Click();
3) Find the ListItem I want to click & scroll to it if it is not visible

Code: Select all

HDComboBoxListItem = HDComboBox.FindSingle<ListItem>("list/listitem[@accessiblename='" + ComboBoxItem + "' or @text='" + ComboBoxItem + "']");

if (HDComboBoxListItem.Visible == false)
{
    HDComboListScrollBar = HDComboBox.FindSingle(".//scrollbar[@accessiblename='Vertical']", 60000);
    if (HDComboListScrollBar.Value != 0)
    {
        HDComboListPageUp = HDComboBox.FindSingle(".//scrollbar/button[@accessiblename='Page up']", 60000);
    }
    while (HDComboListScrollBar.Value != 0)
    {
        HDComboListPageUp.Click();
    }

    HDComboListPageDown = HDComboBox.FindSingle(".//scrollbar/button[@accessiblename='Page down']", 60000);
    while (HDComboBoxListItem.Visible == false)
    {
        HDComboListPageDown.Click();
    }
}

HDComboBoxListItem.Click();
You can use similar code to Open the combo then get the entire list to an array if you want to do that instead of clicking a list item. No Invoke required...
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

atom
Posts: 357
Joined: Sun Dec 07, 2008 11:14 pm
Location: Dublin, Ireland

Re: Dev Express ComboBox

Post by atom » Tue Apr 19, 2011 10:32 am

Hiya

The problem for me is my company have inherited from Dev Express controls to create new ones
But they have the same properties as Dev Express ones
Argh!