Programming Guide : Working with List Views and Tree Views : Treeview Fields : How You Can Use Bitmap Labels
 
Share this page          
How You Can Use Bitmap Labels
A treeview field has an attribute, ImageList, which is an array of bitmaps. In tree_example_2, the set_up_bitmaps procedure sets up the ImageList. In this case, there are three bitmaps: a gray circle, a blue circle, and a red circle. Each of the variables gray, blue, and red contains the index in the ImageList array of the corresponding bitmap.
A tree node has attributes BitmapLabelIndex and SelectedBitmapLabelIndex. You may specify bitmap labels to be displayed with the node by setting BitmapLabelIndex and SelectedBitmapLabelIndex. If BitmapLabelIndex is a valid index in the array ImageList, the corresponding bitmap label is displayed when the node is not selected; if SelectedBitmapLabelIndex is a valid index, the corresponding bitmap label is displayed when the node is selected.
The first treeview example uses no bitmap labels. The second example illustrates the use of bitmap labels. When a node is selected, its bitmap label is blue. Initially, the bitmap label is gray when a node is not selected. When you select a node with a gray bitmap label, the background color of the corresponding field is changed to red, and BitmapLabelIndex is changed to red. When you select a node with a red bitmap label, the background color of the corresponding field is changed back to its original color, and BitmapLabelIndex is set to gray. The code that changes the bitmap labels is in the event block on setvalue tvf.