Forum Discussion
You can write a procedure to click based on text or other properties by evaluating said properties, correlating them to the index, and performing the index based click.
What Ryan said.
Not all tree/list type selectors work properly when addressed directly by text values. You may need to do a bit of searching and evaluating of properties in order to determine the index numbers required.
I have some grids, trees, lists and menus that require a little "pre-work" along these lines.
Not all controls make life simple for you. Same with devs. Combine the two? .........................................
- mrezahoseini9 years agoContributor
I've been working with properties without any result!?
I need other suggestion
Thanks
- Colin_McCrae9 years agoCommunity Hero
I think you missed the point of our comments.
What we're saying is you may not be able to use the text names "directly".
You may need to inspect another property. Dig deeper into it. Find the full list in there somewhere (in text). And from that determine the indexes you need to use. And given that this is a treeview, you may need to go several layers down as you drop through the nodes of the tree.
e.g.
I have a treeview object (in a Delphi application).
Aliases["ThemeModelling"]["SiteSetup"]["Devices"]["DevicesTree"]["TopItem"]["Item"](1)["Text"]
The above would return me the text of the second node off the top node. If I wanted the first item (it is zero indexed) I would use:
Aliases["ThemeModelling"]["SiteSetup"]["Devices"]["DevicesTree"]["TopItem"]["Item"](0)["Text"]
The treeview object itself is:
Aliases["ThemeModelling"]["SiteSetup"]["Devices"]["DevicesTree"]
["TopItem"] is a "property" of ["DevicesTree"]. But it is also an object. With it's own set of properties (click on the ellipses on the right of a property indicate that it is an object and can be drilled further into). Once in ["TopItem"], then ["Item"] is a property of ["TopItem"]. But again, it is an object. But not a singular object. It's a collection (array if you like) of objects. This is indicated by "params" at the start of the line. Enter a valid parameter and the ellipses will appear to drill further into the hierarchy. Once into ["Item"](0) then ["Text"] is a simple string property of the node.
So you may need to loop through several layers of the tree using index numbers if addressing by text doesn't work. I can't say if my example above is the same for you as I don't know the exact type of control you're using. My one works OK if I address it using text values ("Item 1|Item 2| Item 3" .... etc). But if it didn't, I would have to inspect the object using the properties I've shown above to work out numerically where in the tree structure the required node is.
If it's data driven, it could get more complex if some nodes are dynamically excluded (based on data settings at runtime). I've only run into control types of grid and a few dropdowns that use underlying datasets to control their visible content. But nothing to say it couldn't apply to a treeview as well I suppose.
In short .....
Top level simple properties are not always enough. Sometimes you need to dig several layers deep to find the information you need. Also sometimes the info you need may be a "Field" rather than a "Property".