|
|
|
Virtual Data Source |
SftTree/OCX supports "flat" lists only in virtual mode. Hierarchies cannot be represented in virtual mode.
A tree control can be populated using conventional methods by adding items one at a time using the Items.Add or Items.Insert methods. While there is no built-in limit to the number of items added this way, the more items added, the longer it takes.
If an application already has all items in memory or mapped to a database or some other data source from which items can readily be retrieved, there is no need to add all items to the tree control. By implementing the VirtualItem event (the "virtual data source"), the application can provide item information to the tree control as it is needed. Usually, only items that are visible in the tree control window need to be retrieved, ranging from one item to maybe a dozen, depending on the size of the tree control. This results in essentially no time spent populating the tree control. Virtual mode is enabled using the VirtualMode property.
The tree control can be used to display flat lists (without hierarchy) with up to 2,000,000,000 items. Graphics, colors and all tree control data and attributes are provided by the VirtualItem event. This eliminates lengthy initialization when many items are to be displayed. The VirtualItem event can provide all the information to SftTree/OCX, even cell graphics, fonts, etc. Graphics are enabled using the VirtualPictures method.
Some properties and methods are not available when a virtual data source is used. Most properties and methods which update item or cell information can not be used. The application cannot update items in the tree control, it must update its (external) data source instead. By using the provided methods VirtualItemChanged and VirtualCount, an application can notify the tree control that items or item count have been modified by the application.