ComboBox Mania

Class library usage, coding and language questions.
mcs
Posts: 29
Joined: Mon Aug 11, 2014 5:00 pm
Location: Portsmouth, NH

ComboBox Mania

Post by mcs » Fri Nov 21, 2014 6:30 pm

I'm sure that there's a simple solution for this but I'm not getting it.
I'm trying to get the list of values from a .NET ComboBox which is configured as a DropDownList (list only appears after box is clicked/pressed and cannot be written to).
Ranorex Spy appears to see the ComboBox and the list as two different entities and I have exhausted my knowledge on how to get this accomplished. I even built a new C# Windows Form app with just a ComboBox configured as a DropDownList on it to make sure that it was me and not the AUT which was the problem.
It is obvious that it is me so... any help and/or direction would be greatly appreciated.
Thanks!

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: ComboBox Mania

Post by krstcs » Fri Nov 21, 2014 6:52 pm

It's not you...

.NET (like most other platforms/languages) actually creates a new pane for the list when you open a drop-down, and places it only when needed.

What you probably need to do is to spy out the objects (especially the list itself) with the "Ctrl-Left Win" combination.

1. Open spy.
2. Open your application.
3. Click the drop-down to open the list.
4. Move the mouse over the list and press the "Ctrl-Left Win" key combination.

This is how you spy/capture elements that are tricky like menus and drop-downs.
Shortcuts usually aren't...

mcs
Posts: 29
Joined: Mon Aug 11, 2014 5:00 pm
Location: Portsmouth, NH

Re: ComboBox Mania

Post by mcs » Fri Nov 21, 2014 7:38 pm

Thanks, I've tried your suggestion krstcs and, during one of my many tries, I managed to see the list under the comboBox in spy but, as soon as the dropdown closes which is immediately, the list disappears from spy. Any trick that you know to keep it there? I think that once I have it in my repository, things will be easier...
Thanks.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: ComboBox Mania

Post by krstcs » Fri Nov 21, 2014 7:44 pm

Instead of using spy, try with a repository open. The same key-combination will add an item to the repo.

I forgot that spy did that.
Shortcuts usually aren't...

mcs
Posts: 29
Joined: Mon Aug 11, 2014 5:00 pm
Location: Portsmouth, NH

Re: ComboBox Mania

Post by mcs » Fri Nov 21, 2014 8:24 pm

Aha! Thanks again; I didn't know that you could get items into the repository that way. :))