Name
Treeview.GetEntry -- get information about tree entry
Synopsis
found, table = moai.DoMethod(id, "GetEntry", item, position)
Function
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:

Root
Use the root node.

Active
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:

Head
Return information about the first child of the node.

Tail
Return information about the last child of the node.

Active
Return information about the active item.

Next
Return the next entry in the tree after item.

Previous
Return the previous entry in the tree before item.

Parent
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:

Items
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.

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

ID
String object identifier of this tree item.

UID
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.

Inputs
id
id of the treeview object
item
special identifier returned by this method or a special value (see above)
position
index of entry to get or a special value (see above)
Results
found
boolean flag indicating whether or not an entry was found
table
table containing information about found entry
Example
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.

Show TOC