Treeview.GetEntry -- get information about tree entry
found, table = moai.DoMethod(id, "GetEntry", item, position)
Get information about a tree entry. The tree entry can be specified either as an absolute index or also in relation to a specified node or leaf. This allows you to traverse the entire tree. See below for an example.

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:

Use the root node.

Use the active item.

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:

Return information about the first child of the node.

Return information about the last child of the node.

Return information about the active item.

Return the next entry in the tree after item.

Return the previous entry in the tree before item.

Return information about the parent of 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:

This is a table containing the items for all columns of this treeview entry. Note that if the entry is a node, this table will only contain one item because nodes cannot span multiple columns.

True if the found entry is a node, False if it is a leaf.

String object identifier of this tree item.

Internal ID of this tree item. This is the only id you are allowed to pass in the 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.

id of the treeview object
special identifier returned by this method or a special value (see above)
index of entry to get or a special value (see above)
boolean flag indicating whether or not an entry was found
table containing information about found entry
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))
         DebugPrint(IIf(t.Node = True, "+", ""), Unpack(t.items))
      If t.Node = True Then p_DumpListTree(id$, t.uid, indent + 4)
      found, t = moai.DoMethod(id$, "GetEntry", t.uid, "Next")

p_DumpListTree("mytreeview", "root", 0)
The code above shows how to dump the complete contents of a treeview, preserving its structure.

Show TOC