Accessing object method with InvokeRemotely
Posted: Tue Apr 08, 2014 11:17 am
Hi,
please see the attached code:
as you can see i'm sending a Ranorex.Button to showDropDownButtonContextMenu
and than i cast it into Ranorex.Control and perform control.InvokeRemotely(OpenDropdownButton)
which than execute the method on the UI control.
The thing i DON'T understand is why i have to do in order for it to cast the item and not just
when doing the latter it returns null.
i would like to point out that the button is xpath in the repository is [Edit: i forgot to mention that this path is for the button and it sits under a higher level in the repository which contains the form]
so to my understanding going to will actually go to the ontainer[@controlname='grpTerms'] which is weird, or am i mistaken and it goes to element[@controlname='btnCreateTerm']?
also i have tried to define the button in the repository as an element (ommiting the button[@accessiblename='Create'] from Xpath) and than i taught i will not need to go to but it still returns null if i don't go to the elemnt parent.
Regards,
Tnimni
please see the attached code:
Code: Select all
public static object OpenDropdownButton(System.Windows.Forms.Control control, object input)
{
DevExpress.XtraEditors.DropDownButton theButton = control as DevExpress.XtraEditors.DropDownButton;
theButton.ShowDropDown();
return null;
}
public static object showDropDownButtonContextMenu(this Ranorex.Button button)
{
Ranorex.Control control = button.Element.Parent.As<Ranorex.Control>();
control.InvokeRemotely(OpenDropdownButton);
return null;
}
and than i cast it into Ranorex.Control and perform control.InvokeRemotely(OpenDropdownButton)
which than execute the method on the UI control.
The thing i DON'T understand is why i have to do
Code: Select all
button.Element.Parent.As<Ranorex.Control>();
Code: Select all
button.As<Ranorex.Control>();
i would like to point out that the button is xpath in the repository is [Edit: i forgot to mention that this path is for the button and it sits under a higher level in the repository which contains the form]
Code: Select all
container[@controlname='panelClient']/container[@controlname='scMain']/container[@caption='Panel2']/container[@controlname='grpTerms']/element[@controlname='btnCreateTerm']/button[@accessiblename='Create']
Code: Select all
button.Element.Parent
also i have tried to define the button in the repository as an element (ommiting the button[@accessiblename='Create'] from Xpath) and than i taught i will not need to go to
Code: Select all
button.Element.Parent
Regards,
Tnimni