Skip to content

TreeColumn Property

Description

Specifies whether the column has GridRecordItem's that contain an expand/collapse button.

Property Type

Read-write property

Syntax (Visual Basic)

Public Property TreeColumn() As Boolean

Remarks

If TRUE, indicates that some of the GridRecordItem's contain an expand/collapse button that is used to display more GridRecordItem's. This allows you to create a hierarchical list of GridRecordItem's. The expand/collapse button will appear in the column(s) that have the TreeColumn property set to TRUE. The expand/collapse button will only appear if a GridRecordItem has children.

If FALSE, indicates that no GridRecordItem's will contain an expand/collapse button. This needs to be TRUE if you want the expand/collapse button to display in this column.

Example

[Adding a child GridRecordItem. (Visual Basic)] This sample illustrates how to create a hierarchical list of GridRecordItem's. In this sample, two GridRecords are added. The first GridRecord will be the parent to the second GridRecord.

' Add this to the General code section  
Const COLUMN_ICON = 0  
Const COLUMN_CHECK = 1  
Const COLUMN_SUBJECT = 2  
Const COLUMN_FROM = 3  
Const COLUMN_SENT = 4  
Const COLUMN_SIZE = 5  

' This code is placed in the Form_Load event  
Dim Column As GridColumn  

Set Column = wndGridControl.Columns.Add(COLUMN_ICON, "Icon", 18, False)  
Column.Icon = 0  

Set Column = wndGridControl.Columns.Add(COLUMN_CHECK, "Check", 18, False)  
Column.Icon = 1  

Set Column = wndGridControl.Columns.Add(COLUMN_SUBJECT, "Subject", 280, True)  

' The TreeColumn property must be TRUE because you want the expand/collapse button to appear  
' in this column  
Column.TreeColumn = True  

wndGridControl.Columns.Add COLUMN_FROM, "From", 180, True  
wndGridControl.Columns.Add COLUMN_SENT, "Sent", 150, True  
wndGridControl.Columns.Add COLUMN_SIZE, "Size", 50, True  
wndGridControl.Columns.Add COLUMN_PRICE, "Price", 80, True  

wndGridControl.SetImageList ImageListGrid  

Dim Record As GridRecord  
Dim ChildRecord As GridRecord  
Dim Item As GridRecordItem  

' This is the parent Record that will have a GridRecordItem  
' added to its collection of child GridRecordItems.  
Set Record = wndGridControl.Records.Add  
    Set Item = Record.AddItem("")  
        Item.HasCheckbox = True  
        Item.Checked = False  
    Record.AddItem "RE: Your Invoice"  
    Record.AddItem "John Smith"  
    Record.AddItem "19/06/2004"  
    Record.AddItem "18k"  

' This record will be added to the parent record's collection of child  
' GridRecordItem's. All child records will be displayed when the  
' expand/collapse button is pressed.  
Set ChildRecord = Record.Childs.Add()  
    Set Item = ChildRecord.AddItem("")  
        Item.HasCheckbox = True  
        Item.Checked = False  
    ChildRecord.AddItem "RE: Your Invoice"  
    ChildRecord.AddItem "Tom Green"  
    ChildRecord.AddItem "21/06/2004"  
    ChildRecord.AddItem "14k"  

See Also

GridColumn Object


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.