OnCreateTree - TreeView
Fired when the tree is created
Type: Event
Syntax
Procedure OnCreateTree
Description
OnCreateTree is the key event of this class. This is the event that is typically used to populate the control with items.
AddTreeItem can be used at any time "during or after" OnCreateTree. It can only be used when the control has been created. This event will fire whenever the control becomes visible, to rebuild the list.
Sample
This sample shows how to populate a TreeView with items in the OnCreateTree event.
Object oTreeView1 is a TreeView
Set Size to 158 141
Set Location to 15 12
// called when TreeView is created
Procedure OnCreateTree
Handle hRoot hBranch
// create root node
Get AddTreeItem "Root" 0 0 0 0 to hRoot
// create branch nodes
Get AddTreeItem "Branch1" hRoot 0 0 0 to hBranch
Get AddTreeItem "Branch2" hRoot 0 0 0 to hBranch
Get AddTreeItem "Branch3" hRoot 0 0 0 to hBranch
End_Procedure
End_Object
Note that data in this object is created when the object is paged, and destroyed when the object is unpaged. If you are using tab dialogs a tree view objects, data is rebuilt each time the object is paged. This means that if you use this control inside a TabDialog control, this event will fire each time a user rotates the pages to display it, so you should avoid lengthy computations, if at all possible.