please help with a DevExpress Invoke Remotely

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

please help with a DevExpress Invoke Remotely

Post by Ciege » Mon Mar 01, 2010 6:27 pm

I'm having problems creating an invoke remotely for a DEvExpress XtraTreeList...
I'm trying to get the checked state of a treeListNode since Ranorex reports it as always False regardless of if it is checked or not.

Here is my object code.

Code: Select all

static object GetCheckState(System.Windows.Forms.Control control, object input)
{
    DevExpress.XtraTreeList.Nodes.TreeListNode treeListNode = (control as DevExpress.XtraTreeList.Nodes.TreeListNode);
    bool boolChecked = treeListNode.Checked;
    return boolChecked;
}
However, when I compile I get this compiler error which I do not know how to resolve.

Code: Select all

Cannot convert type 'System.Windows.Forms.Control' to 'DevExpress.XtraTreeList.Nodes.TreeListNode' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion
Can you please help me out by letting me know what I am doing wrong?

Thanks all!
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...

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

Re: please help with a DevExpress Invoke Remotely

Post by Ciege » Mon Mar 01, 2010 11:43 pm

Well it took persistence but I got it... Here is the code that works to return a bool of a treeItem check state.

Code: Select all

public static object TreeNodeGetCheckState(System.Windows.Forms.Control control, object input)
{
    DevExpress.XtraTreeList.TreeList treeList = control as DevExpress.XtraTreeList.TreeList;
    DevExpress.XtraTreeList.Nodes.TreeListNode RequestedTreeNode = treeList.FindNodeByID(Convert.ToInt16(input));
    bool boolChecked = RequestedTreeNode.Checked;
    return boolChecked;
}
And just for giggles here is code to check or uncheck a treeItem node:

Code: Select all

public static object TreeNodeCheck(System.Windows.Forms.Control control, object input)
{
    DevExpress.XtraTreeList.TreeList treeList = control as DevExpress.XtraTreeList.TreeList;
    DevExpress.XtraTreeList.Nodes.TreeListNode RequestedTreeNode = treeList.FindNodeByID(Convert.ToInt16(input));
    if (RequestedTreeNode.Checked != true)
    {
        RequestedTreeNode.CheckState = CheckState.Checked;
    }
    return null;
}

public static object TreeNodeUncheck(System.Windows.Forms.Control control, object input)
{
    DevExpress.XtraTreeList.TreeList treeList = control as DevExpress.XtraTreeList.TreeList;
    DevExpress.XtraTreeList.Nodes.TreeListNode RequestedTreeNode = treeList.FindNodeByID(Convert.ToInt16(input));
    if (RequestedTreeNode.Checked != false)
    {
        RequestedTreeNode.CheckState = CheckState.Unchecked;
    }
    return null;
}
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: please help with a DevExpress Invoke Remotely

Post by atom » Mon Mar 08, 2010 7:16 pm

Out of curiousity how are you implementing all your remove methods?
We do following say for XtraGrid:

- Create a class CXtraGrid
- Expose public methods from CXtraGrid that do operations you want
- Inside each method call remote invoke to do the operation

My concern is that EVERYONE using ranorex and dev express has to go through all this implementation themselves... either Ranorex (or us as a community) should create a plugin dll, we can share!

Why? Because developers tend to "go to town" with dev express, and use alot of controls that you have to remove invoke, it takes alot of time to go through dev express api, and create all your delegates. If there was a dll somewhere containing all the useful ones i'd be happy(ier)!

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

Re: please help with a DevExpress Invoke Remotely

Post by Ciege » Mon Mar 08, 2010 7:31 pm

Well, if I understand your question correctly, what I do is this...
My AUT/Ranorex framework (RFW) contains the GetState, Check, Uncheck, etc methods. The framework also contains the proper references to the DevExpress controls that are needed.
The testing code contains a reference to the framework DLL. When needed, the testing code just calls the method required from the framework as a InvokeRemotely.

For example, this is a call from the test script to check all text boxes in a tree.
You will notice TWO InvokeRemotely's. One to verify the the Tree is in an expanded state (RFW.CallExpandAll) and the second within the foreach to check the treenode (RFW.TreeNodeCheck)

Code: Select all

IList<Ranorex.TreeItem> ContainerItems = PBSLayersTreeContainer.FindChildren<Ranorex.TreeItem>();

PBSLayersTreeControl.InvokeRemotely(RFW.CallExpandAll);

foreach (Ranorex.TreeItem treeItem in ContainerItems)
{
    PBSLayersTreeControl.InvokeRemotely(RFW.TreeNodeCheck, treeItem.Element.ChildIndex);
}

Is that what you were looking for?
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...