trouble getting the selected text of Systreeview32 control : Automation API

trouble getting the selected text of Systreeview32 control

Class library usage, coding and language questions.

trouble getting the selected text of Systreeview32 control

Postby creynolds » Fri Mar 28, 2008 6:38 pm

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
creynolds
 
Posts: 4
Joined: Tue Sep 18, 2007 4:45 pm
Location: USA

Postby Support Team » Fri Mar 28, 2008 7:21 pm

Can you please try the following code:
(Element approach)

Code: Select all
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
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests

cron