Forum Discussion

JackEthel's avatar
JackEthel
Senior Member
8 years ago

How to get Node's name in CustomTreeList

Hello,

 

I'm new in TestComplete

Sorry in advance I dont speach english very well :-)

 

So, I work in a desktop application which contains a CustomTreeList object. I just try to know how to get any node's name (Label) but I still failed. I use VBScript language to write script.

 

I able to count how many nodes inside CustomTreeList with :

(...).Afx.HwndSource_CommandDispatcherControl.WinFormsAdapter.NavigationControl.splitContainerControl1.SplitGroupPanel.navigationTree.AllNodesCount

or

(...).Afx.HwndSource_CommandDispatcherControl.WinFormsAdapter.NavigationControl.splitContainerControl1.SplitGroupPanel.navigationTree.get_AllNodesCount

or (in only first column)

(...).Afx.HwndSource_CommandDispatcherControl.WinFormsAdapter.NavigationControl.splitContainerControl1.SplitGroupPanel.navigationTree.get_Nodes.Count

 

I already able to get to any node in the depth of  CustomTreeList object with "wChildView" command, for eg :

(...).Afx.HwndSource_CommandDispatcherControl.WinFormsAdapter.NavigationControl.splitContainerControl1.SplitGroupPanel.navigationTree.wChildView(3).wChildView(0).ClickCell(1, "Name")

 

And now, I need to know how can I get node's name.

 

Can you help me please.

 

Thanks a lot

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Probably the best place to start is to look at how TestComplete works with developer express controls, specifically the tree list.  Read up on it at https://support.smartbear.com/testcomplete/docs/reference/test-objects/controls/desktop/dev-express/winforms/xtra-tree-list/index.html

     

    Beyond that, I'm not fully experience with using that set of controls so I don't know specifics.  The best advice I can give you is to start exploring the objects, looking for native methods and properties that will get you the node name. I believe you're going to want to find the "Caption" property.

     

    So.... the question is:

     

    Are you looking to find the caption of a node for which you don't already know the name?

    Or are you looking to find the node that matches the captionyou already know?

     

    The latter is easier... you loop through all the nodes using a for or while loop until you find a matching caption.  The former.... not so easy. ;)