Bueno aqui va esta función que a mi forma de ver es una gran carencia ( entre otras...) de este objeto , se me hacia un mundo no poder obtener una información completa de todos los nodos del objeto.
La funcion retorna una tabla con las propiedades de cada nodo del objeto tree al igual que la función Tree.GetNode que ya dispone.
La funcion retorna una tabla con las propiedades de cada nodo del objeto tree al igual que la función Tree.GetNode que ya dispone.
--------------------------- Function Tree.GetNodes--------------------------
-- Args: --
-- TreeName: The Name of Tree Object. --
--------------------------------------------------------------------------
function Tree.GetNodes(TreeName)
TreeName = TreeName or "Tree1";
local a= 0;
local b;
local tb={};
function node(ta)
local k;
if type(ta)=='table'then
for x = 1,#ta do
strNodeIndex=ta[x].NodeIndex;
k = Tree.GetChildren(TreeName,strNodeIndex);
tb[#tb+1]={ Text=ta[x].Text,
NodeIndex=ta[x].NodeIndex,
Data=ta[x].Data,
Selected=ta[x].Selected,
Expanded=ta[x].Expanded,
Checked=ta[x].Checked,
ImageIndex=ta[x].ImageIndex,
SelectedImageIndex=ta[x].SelectedImageIndex};
if k then
t=node(k);
end
end
return tb
end
end
repeat
b = Tree.GetChildren(TreeName,tostring(a));
if b then
t=node(b);
break;
end
until b==nil;
return t;
end
t=Tree.GetNodes(TreeName);
Debug.ShowWindow(true);
for x=1,#t do
Debug.Print("Node Name : "..t[x].Text.."Node Index : "..t[x].NodeIndex.."\r\n");
end