Adding Checkboxes to a Tree View

Previous Next

See Also

You can add checkboxes to a tree view by adding an additional column to the queries of tree view nodes. The additional column must have the "TREE_STATE" alias. For example:

SELECT    p.first_name||' '||p.last_name, DECODE(p.GENDER, 'M', 'Y', 'N') "tree_STATE"

FROM      person p

ORDER BY  p.last_name

Once the TREE_STATE column has been added to the SQL query for the node, a checkbox is displayed for the node. Possible values and corresponding states for the checkbox are:

Value

Checkbox State

NULL

No checkbox (TREE_STATE column not in query)

N

Y

U

X

 

When a checkbox is displayed for an item, the user can change the state of the checkbox by using the mouse or the space bar. The sequence of values (states) that is looped through is N, Y, U then X. This sequence repeats indefinitely.

You can restrict the loop using the following properties, available in the Windows Designer Property Inspector for the Tree View Node in question:

Property

Purpose

Exclude State

Adds or removes state from the loop

Unchecked State

Adds or removes state from the loop

Undetermined State

Adds or removes state from the loop

 

There are also two additional properties available for use with checkboxes in Tree Views:

Property

Purpose

CheckBox Action

An action specified here is executed when the state changes.

Sync. Child State

When set to 'Yes' a connection is created between parent and child items. When the parent item changes state the child items will follow (when they display a checkbox). When a child item changes state the parent item (when it displays a checkbox) is set to the state.