| View previous topic :: View next topic |
| Author |
Message |
creynolds
Joined: 18 Sep 2007 Posts: 4 Location: USA
|
Posted: 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 |
|
 |
Support Team Site Admin
Joined: 07 Jul 2006 Posts: 344
|
Posted: 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 |
|
 |
|