I want to be able to send an object description to a utility function that allows me to perform an action on the object I sent
Simple CSHARP Example:
//***** Set variable foo to object to be referenced
var foo = repo.FormNMS_b4_1_0_15.ContainerContainerContainer.TabPageNode_List;
foo.click(); //***** Action performed on the object
Is there a casting I can do?
Can I define the variable as a particular type?
tried:
var foo = (Rxpath) repo.FormNMS_b4_1_0_15.ContainerContainerContainer.TabPageNode_List;
var foo = (Ranorex.TabPage) repo.FormNMS_b4_1_0_15.ContainerContainerContainer.TabPageNode_List;
Ranorex.Tabbpage foo = repo.FormNMS_b4_1_0_15.ContainerContainerContainer.TabPageNode_List;
var foo = (Ranorex.Core.Repository.RepositoryEntry)
repo.FormAmbientNMS_b4_1_0_15.ContainerContainerContainer.TabPageAmbient_Node_List;
RxPath foo = "repo.FormAmbientNMS_b4_1_0_15.ContainerContainerContainer.TabPageAmbient_Node_List";
var foo = (Ranorex.Core.Repository.RepositoryItem)
repo.FormAmbientNMS_b4_1_0_15.ContainerContainerContainer.TabPageAmbient_Node_List;
Object referenceing
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Object referenceing
Hi,
Sorry but I am not sure if I completely got your question.
You can of course define a variable as a particular type, you just have to make sure that you are using the right one.
For instance if your repo item "is" a checkbox you can create a new CheckBox variable like:
Markus
Ranorex Support Team
Sorry but I am not sure if I completely got your question.
You can of course define a variable as a particular type, you just have to make sure that you are using the right one.
For instance if your repo item "is" a checkbox you can create a new CheckBox variable like:
Ranorex.CheckBox checkBox = repo.Calculator.CheckBox146; checkBox.Click(); // OR var checkBox1 = repo.Calculator.CheckBox146; checkBox1.Click();Regards,
Markus
Ranorex Support Team
Re: Object referenceing
Almost there ... looking for further abstraction. Want to set up a function call objClick((casting) itemToClick) where the itemToClick is any valid object that can be clicked (Into a textbox, a button, a treeitem) and the casting is some sort of neutral definition (like object or RxPath). If I must identify each object by its specific type (Ranorex.Checkbox) then I lose the abstraction and would likely stick with the "repo" id (repo.container.myCheckbox).
Lee
Lee
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Object referenceing
Hi,
Okay now I got it .
You can for instance use the following definition of a method:
Regards,
Markus
Ranorex Support Team
Okay now I got it .
You can for instance use the following definition of a method:
... generalMethod(repo.Calculator.CheckBox146); } public void generalMethod(Adapter adapter){ adapter.Click(); }I hope this will help solve the issue!
Regards,
Markus
Ranorex Support Team