12.4. Utilizing row data

The CTree widget allows you to associate data with each node of the tree. This is most often used in callbacks, such as when a row is selected.

Although only a single data element can be stored for each row, this data element can be any variable or data structure, which indirectly allows a set of data to be referenced.

The method for setting row data is:
 
ctree.node_set_row_data(node, data)

The method set_row_data() simply takes as arguments references to the node and data.

The method:
 
data = ctree.get_row_data(node)

retrieves the data associated with a node.