Hi
When I try to create a ComboBox like this:
Ranorex.Control control = null;
control = new Ranorex.ComboBox();
I get the Error: "'Ranorex.ComboBox' does not contain a constructor that takes '0' arguments (CS1729)"
After looking Ranorex.ComboBox up in the Documentation, it said that a Element is needed (Which is normally not needed)
How can I make this work?
Thanks in Advance, Alen
Problems with creating a Ranorex.Combobox
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: Problems with creating a Ranorex.Combobox
Alen,
What are you exactly trying to accomplish ?
If you want to automate a specific combo box, just use:
ComboBox myComboBox = "/combobox[..]";
The path can usually be found by using the Ranorex Spy tool.
If you are working with Ranorex Studio you can just drag-drop the element from the Element Tree
into your source code, or use the repository to access the element.
For more information, please hava a look at this:
http://www.ranorex.com/support/user-gui ... apter.html
Michael
Ranorex Team
What are you exactly trying to accomplish ?
If you want to automate a specific combo box, just use:
ComboBox myComboBox = "/combobox[..]";
The path can usually be found by using the Ranorex Spy tool.
If you are working with Ranorex Studio you can just drag-drop the element from the Element Tree
into your source code, or use the repository to access the element.
For more information, please hava a look at this:
http://www.ranorex.com/support/user-gui ... apter.html
Michael
Ranorex Team
-
- Posts: 6
- Joined: Tue Jun 16, 2009 9:37 am
Re: Problems with creating a Ranorex.Combobox
Hi Michael,
what I'm trying to accomplish is having one object(in that case I tried it with control).
I want to be able to use this object to create an instance of a combobox or button or list etc...(determined by a condition)
I would then be able to load the rxpath to this instance... in my particular case this is needed...
It seems like there's a problem with converting control into combobox, but i havent found another way.
mvH Alen
what I'm trying to accomplish is having one object(in that case I tried it with control).
I want to be able to use this object to create an instance of a combobox or button or list etc...(determined by a condition)
I would then be able to load the rxpath to this instance... in my particular case this is needed...
It seems like there's a problem with converting control into combobox, but i havent found another way.
mvH Alen
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: Problems with creating a Ranorex.Combobox
Hmm, am I guessing right that you want to use different adapter types (ComboBox, Control, ...) with the same element? If that's right you can do that the following way:
Alex
Ranorex Support Team
Ranorex.Unknown elem1 = "pathToTheElement"; // elem1 found directly through RxPath Ranorex.Unknown elem2 = myRepo.MyAppFolder.MyElement; // elem2 got via Ranorex repository // to access different attributes/actions of the element we need // to create the corresponding adapter Ranorex.Control control1 = elem1.As<Ranorex.Control>(); // returns null if elem1 is no Control Ranorex.Control control2 = new Ranorex.Control(elem2); // raises an exception if elem2 is no Control // now we can use the Control actions/attributes object propertyValue = control1.GetPropertyValue("SomePropertyName");Regards,
Alex
Ranorex Support Team
-
- Posts: 6
- Joined: Tue Jun 16, 2009 9:37 am
Re: Problems with creating a Ranorex.Combobox
That is exactly what I needed.
Thank you very much!
mvH Alen
Thank you very much!
mvH Alen