Tips_gui   >   Treelists   >   Treelist Columns

Treelist Columns

The treelist object supports displaying columns of data for each node in the treelist. If you are unsure of what that looks like, click the Run Demo button in the StudioTips Browser window to view a columns list style treelist.

To set up a treelist with additional columns you need to do the following:

  1. Select the treelist object > press F9 to open the Properties Manager > select the Appearance tab.
  2. Set the following properties in order to display additional columns of data for each node.
    • $designcols - to the number of columns of data you wish to display. Column one is the treelist nodes column.
    • $hideheader - to kFalse so that the columns header will be displayed.
    • $columnnames - to a CSV string of names you want to use for the column headers.

    There are additional properties that you can set which affect the columns.

To display data in the treelist columns you have to set the $rowdata node property with a row variable that has the data you want to display in the correct order. Column 1 of the $rowdata will be displayed in column 2 of the treelist object columns, column 2 of the $rowdata in column 3 of the treelist object columns, etc.

There are two ways you can load the $rowdata into the treelist object:

  1. Adding a Rowdata column to the list variable which you use to $setnodelist and preloading that column for each line in the list with the $rowdata you want displayed. Once the list variable is prepared you use $setnodelist to load the treelist object.
  2. Assigning the $rowdata property using notation. (This is the technique I prefer.) See the $rowdata topic in this section for more information.



Lets the user edit the text for a column in the currently selected line, when the tree is the current field. The node (column 1) can only be entered if its $enterable property is kTrue. You can control whether other columns can be entered using the evTreeListEditStarting event.

To stop columns from being editable add this to the $event method of the treelist object:

; Prevent text editing of columns.
On evTreeListEditStarting
Quit event handler (Discard event)


You only need to worry about the $edittext method if you want to initiate setting the user to edit a specific column in the treelist object. By deafult the user can click on any column in the treelist object and Omnis Studio will let the user edit the column value if you didn't discard the evTreeListEditStarting event.



Returns the alignment of the specified column. This only applies to trees with multiple columns.

; Get the column alignment for the 2nd column.
; kAlign will be: kCenterJst, kLeftJst, or kRightJst
Do irTree.$getcolumnalign(2) Returns kAlign



Each node in a treelist has a $rowdata property. You can set any row variable to the $rowdata property at any time. Once the $rowdata property has been set you can get the $rowdata from the node.

The data in the columns of the $rowdata property is displayed in the columns of a treelist object which has the $designcols property set to a value greater than zero.

; Set the row data for the specified node.
Do rNode.$rowdata.$assign(Row)
; or
Calculate rNode.$rowdata as Row

; Get the row data from the specified node.
Calculate Row as rNode.$rowdata

The following sample code demonstrates how you can get the value for a column in the row data which the user has just edited.

On evTreeListEditFinished

; Get the $rowdata for the current node.
Calculate Row as pNodeItem.$rowdata

; Get the value of the clicked column.
; The $rowdata column number is one less than the treelist column number.
Calculate Value as Row.[pColumnNumber-1]



Sets the alignment of the specified column. You can specify kAlign as kLeftJst, kRightJst, or kCenterJst. The property $columnalignmode controls how $setcolumnalign affects the field. This only applies to trees with multiple columns.

; Set the column alignment for the 2nd column.
Do irTreeObj.$setcolumnalign(2,kCenterJst)