TreeView.PathSeparator broken? : Automation API

TreeView.PathSeparator broken?

Class library usage, coding and language questions.

TreeView.PathSeparator broken?

Postby aldo.longhi » Wed Jun 23, 2010 10:50 pm

It appears to me that the PathSeparator property of the TreeView class is broken in Ranorex.Net 1.4 - or else I just don't know how it is meant to work.

I have items in a TreeView whose text contains a slash character ('/'), which is the default PathSeparator character.

parent1
- child/1
- child/2
parent2
- child/3
- child/4

Therefore I set the PathSeparator property on my TreeView object to something else ('#') and then call the SelectPath(string path) method with a value like "parent1#child/1" but this fails (returns -3, I believe).

In troubleshooting the problem, I tried printing the current value of the PathSeparator property and it appears empty. By attaching a debugger I see that the property's value is null, even immediately after I assign the string "#" to it.

Am I doing something wrong?

Windows 7
Ranorex.Net 1.4.0.7

Thank you,
- Aldo
aldo.longhi
 
Posts: 4
Joined: Thu Mar 18, 2010 2:19 am

Re: TreeView.PathSeparator broken?

Postby Support Team » Thu Jun 24, 2010 2:52 pm

The TreeView.SelectPath available in Ranorex 1.X always uses "/" as path separator; you can't change the path separator used by this method, sorry!

aldo.longhi wrote:In troubleshooting the problem, I tried printing the current value of the PathSeparator property and it appears empty. By attaching a debugger I see that the property's value is null, even immediately after I assign the string "#" to it.

The Ranorex.TreeView.PathSeparator property does not change the behavior of the SelectPath method. It actually gets/sets the PathSeparator property of the .NET TreeViw control corresponding to that Ranorex element. However, that can only work if the control you automate is a Windows Forms TreeView. I guess that the control you try to automate is not a Windows Forms control and that you have Ranorex.Application.ErrorAsException set to false, that's why Ranorex always returns null for this property. If you set ErrorAsException to true, an exception will be thrown when you access the PathSeparator property stating that your tree view is not a Windows Forms control.

Instead of the SelectPath method try to use the SelectItem methods to select the individual TreeView items one by one; e.g.:
int parentItem = tree.SelectItem("parent1");
parentItem = tree.SelectItem("child/1", parentItem);
parentItem = tree.SelectItem("child of child/1", parentItem);

Regards,
Alex
Ranorex Support Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: TreeView.PathSeparator broken?

Postby aldo.longhi » Thu Jun 24, 2010 6:45 pm

Alex,

Thank you for your prompt response! I have posted a few questions now, and have always received very informative answers very quickly!

Your guess is correct; the application under test uses wxWidgets rather than windows forms.

I was not aware of the Application.ErrorAsException property; I will investigate and consider the implications of turning it on.

Also, I think I have not used the second version of TreeView.SelectItem before. With this new information, I am planning to implement my own method (in a subclass of Ranorex.TreeView) for selecting a given "path" that will support an alternate path separator. This SelectItem method may be useful in doing that.

Thank you again for your reply; I become more impressed each time I post a question!
aldo.longhi
 
Posts: 4
Joined: Thu Mar 18, 2010 2:19 am


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests

cron