Ranorex

trouble getting the selected text of Systreeview32 control

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexPython
View previous topic :: View next topic  
Author Message
creynolds



Joined: 18 Sep 2007
Posts: 4
Location: USA

PostPosted: Fri Mar 28, 2008 6:38 pm    Post subject: trouble getting the selected text of Systreeview32 control
I'm having trouble getting the selected text of a treeview control using the following code:

form = Application.FindForm("form title", SearchMatchMode.MatchExact, "AfxFrameOrView70u", false, 5000);
form.Activate();

control = form.FindControlId(5858);
control.Focus();
TreeView treeview = form.FindTreeView(5858);
string text = treeview.SelectedText;

The text is always null. I have had trouble with this control in the past and have had to walk the tree with keystrokes to populate all of the nodes, but now I can't get any info on it. ItemCounts, selected text and rootItems are all empty.

Any help would be great
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 344

PostPosted: Fri Mar 28, 2008 7:21 pm    Post subject:
Can you please try the following code:
(Element approach)

Code: click into code to enlarge
Element[] treeItems = treeView.Element.FindChildren(Role.OutlineItem);
foreach (Element item in treeItems)
{
    Console.WriteLine("Item = {0} ", item.Name);
    if ((item.State & State.Selected) != 0)
        Console.WriteLine("  SelectedItem= {0} ", item.Name);
}


Jenö
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexPython All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum