treenode_define <type> "{" <data-block> "}"
To define a treenode class structure for node objects in a tree window.
<type>
The name of the treenode class.
This must be a member of an application
atable.
None
Each line of the data block defines a class value for the structure, in the form:
<member> = <value>
where <member> is one of:
class_image, <value> is a 1 or 2-element string
When a new class node is added and no images are specified, these default class images are used. Two image files are permitted, the first displayed when the node is contracted, the second when the node is expanded.
class_label, <value> is a string
When a new class node is added and no label is specified, this default class label is used.
check, <value> is a procedure
This is a callback invoked when a node of this class has its check box toggled interactively.
contract, <value> is a procedure
This is a callback invoked when a node this type is contracted.
delete, <value> is a procedure
This is a callback invoked when a node this type gets interactively deleted.
deselect, <value> is a procedure
This is a callback invoked when a node this type gets deselected.
exec, <value> is a procedure
This is a callback invoked when the user presses the return key when the node is selected.
expand, <value> is a procedure
This is a callback invoked when a node this type is expanded.
node_name, <value> is a string
This defines a class node name for nodes of this class. This name provides a convenient way for child nodes of the node to refer to the node. See treenode.node_name for more details.
populate, <value> is a procedure
This is a callback invoked when a node this type requires dynamic population.
rename, <value> is a procedure
This is a callback invoked when a node this type gets interactively renamed.
select, <value> is a procedure
This is a callback invoked when a node this type gets selected.
value_image, <value> is a 1 or 2-element string
When a new value node is added and no images are specified, these default value images are used. Two image files are permitted, the first displayed when the node is contracted, the second when the node is expanded.
The class command may also be used to define a treenode class, by inheriting from treenode.
# Define a class of treenode to represent a database treenode_define ~test.database_t { class_label = 'Databases' class_image = <'folder_0.xpm','folder_1.xpm'> value_image = <'book_0.xpm','book_1.xpm'> populate = { # When a node requires population ... args t=treenode if (t.has_value) { # Expanding a value node - add users and tables # class nodes t.add_child('~test.user_t') t.add_child('~test.table_t') } else { # Expanding a class node - show all databases t.add_child('~test.database_t',1,0,0,0,'DB1') t.add_child('~test.database_t',1,0,0,0,'DB2') } } }
Commands: |
|
Identifiers: |
tn# (treenode) |
Structures: |