Navigation in Tree View

Class library usage, coding and language questions.
Nik
Posts: 18
Joined: Fri Sep 29, 2006 1:35 am

Navigation in Tree View

Post by Nik » Tue Oct 31, 2006 2:05 am

I want to select a file in tree view. The file is in embedded folder.
I tried using RxTreeViewSelectPath but this is not working.
Can you suggest some way of implementing this.
For e.g. I want to navigate to C:\Folder1\Folder2\ABC.txt.

I am using VC6.0 on WinXP.

-Nikhil

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Wed Nov 01, 2006 12:32 pm

We cannot reproduce the bug with the windows explorer.
Do you use forward slashes "/" between the folder names?

Code: Select all

RxTreeViewSelectPath(hTreeView, "Work (D:)/Ranorex/Samples/RanorexCppSample2");
...
But you can easily implement the functionality with elements:

Code: Select all

// Selecting the path "Work (D:)\Ranorex\Bin"
ElementStruct element;
if ( RxControlGetElement(hTreeView, &element) == TRUE)
{
  ElementStruct treeItem1;
  if ( RxElementFindChild(&element, ROLE_SYSTEM_OUTLINEITEM, "Work (D:)", NULL, &treeItem1)==TRUE)
  {
    RxElementSelect(&treeItem1, SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION);
    ElementStruct treeItem2;
    if( RxElementFindChild(&treeItem1, ROLE_SYSTEM_OUTLINEITEM, "Ranorex", NULL, &treeItem2)==TRUE)
    {
      RxElementSelect(&treeItem2, SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION);
      ElementStruct treeItem3;
      if( RxElementFindChild(&treeItem2, ROLE_SYSTEM_OUTLINEITEM, "Bin", NULL, &treeItem3)==TRUE)
        RxElementSelect(&treeItem3, SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION);
    }
  }
}
Jenö Herget
Ranorex Team