Reading child item values from a TreeList
Hello,
I'm curious if there is any better way to go about selecting items from my TreeList object. Currently, I am usinga scipt like this one:
function OpenDataTablePanel(tableNo)
{
if(tableNo == undefined)
{
tableNo = 0
}
var treeListEx = Aliases["Spry"]["Main"]["LeftPanel"]["ProjectExplorer"]["tree"];
treeListEx["wChildView"](0)["wChildView"](0)["DblClickCell"](tableNo, "Column");
}
Basically, the code snippet here goes to my tree list and clicks the desired item with the user specified index, defaulting to 0. What I'm wanting to do, is somehow read the treelist items, and click on the one that has the name that I want to do.
The issue is, I'm not able to read any of the treelist items, only the focusedvalue property.
If anyone has any suggestions to how I can solve this issue, I would be very appreciative.
Thank you
It's a bit of an odd task, I was hoping there was some way to be able to write a piece of reusable code that I could use with most treeLists I encounter in my program. This is was I came up with so far, but my programming knowledge is limited so I may also be missing something.
function GetIndexOfDataTable(name)
{
var treeListEx = Aliases["Spry"]["Main"]["LeftPanel"]["ProjectExplorer"]["tree"];
var dataRoot = treeListEx["wChildView"](0);
var data = dataRoot["wChildView"](0);
var rowCount = data["wRowCount"];
var indexer = 0;
while(indexer < rowCount)
{
var testTable = treeListEx["wChildView"](indexer);
data["ClickCell"](indexer,"Column");
if(treeListEx["FocusedValue"] == name)
{
data["DblClickCell"](indexer,"Column");
return indexer;
}
indexer = indexer + 1;
}
return null;
}