found, table = moai.DoMethod(id, "GetEntry", item, position)
item
specifies the tree item to use as a reference point. This can be a
node or a leaf. Note that in contrast to all other methods or attributes
of Treeview class, item
must not be a string identifier but a special value
returned by this method in the UID
table field (see below) or obtained
by querying Treeviewleaf.UID or Treeviewnode.UID for
an item. Alternatively, it can be one of the following special values:
Root
Active
position
can either be a number or a special value. Passing a number is only
supported when the specified item
is a node. In that case, the number indicates
the index of the child you want to get information about, starting from 0, i.e.
passing 5 here would return information about the sixth child of the node passed
in item
. Alternatively, you can pass the following special values in position
:
Head
Tail
Active
Next
item
.
Previous
item
.
Parent
item
.
This method returns two values: The first return value is a boolean
flag which indicates whether or not an item was found. If the first
return value is True
, the second return value is a table with the
following fields initialized:
Items
Node
True
if the found entry is a node, False
if it is a leaf.
ID
UID
node
argument of this method. Passing standard string
object identifiers is not allowed by this method. You can use this value
for subsequent calls to Treeview.GetEntry in the node
argument
See above for more information and below for an example. You can also
obtain UIDs by getting the Treeviewleaf.UID or Treeviewnode.UID attribute.
Function p_DumpListTree(id$, node, indent) Local found, t = moai.DoMethod(id$, "GetEntry", node, "Head") While found = True If indent > 0 DebugPrint(RepeatStr(" ", indent) .. IIf(t.Node = True, "+", ""), Unpack(t.items)) Else DebugPrint(IIf(t.Node = True, "+", ""), Unpack(t.items)) EndIf If t.Node = True Then p_DumpListTree(id$, t.uid, indent + 4) found, t = moai.DoMethod(id$, "GetEntry", t.uid, "Next") Wend EndFunction p_DumpListTree("mytreeview", "root", 0)The code above shows how to dump the complete contents of a treeview, preserving its structure.