- Working with trees is relatively straightforward if all the items are added to
- the tree at the moment of its creation. However, for large trees it may be
- very inefficient. To improve the performance you may want to delay adding the
- items to the tree until the branch containing the items is expanded: so, in the
- beginning, only the root item is created (with
- #AddRoot). Other items are added when
- EVT_TREE_ITEM_EXPANDING event is received: then all items lying immediately
- under the item being expanded should be added, but, of course, only when this
- event is received for the first time for this item - otherwise, the items would
- be added twice if the user expands/collapses/re-expands the branch.
+In addition to its icon and label, a user-specific data structure may be
+associated with all tree items. If you wish to do it, you should derive a class
+from wxTreeItemData which is a very simple class having only one function
+GetId() which returns the id of the item this data is associated with. This
+data will be freed by the control itself when the associated item is deleted
+(all items are deleted when the control is destroyed), so you shouldn't delete
+it yourself (if you do it, you should call SetItemData(@NULL) to prevent the
+tree from deleting the pointer second time). The associated data may be
+retrieved with GetItemData() function.