{ <window> = } wtree <type>, <file>
or
{ <window> = } wtree <type> { <data block> }
or
{ <window> = } wtree
Define a tree window, a pictorial representation of an object parent/child hierarchy. Each branch or leaf in the tree is referred to as a tree node.
<window>
A window identifier
whose contents are to contain the tree. If this is omitted, the next free
window will be used.
<type>
If present, then
the tree is to be a simple or homogeneous tree where all tree nodes are
of type <type>,
which must be a treenode class.
The tree is initially populated within this command from data in a data block or file.
If not present, then the tree is to be populated dynamically by subsequent commands and interactive operations.
<file>
A text file providing initial
tree node data. There is no default file extension. If this parameter
is not present, tree node data will be expected to appear in a data block
following the command line.
-at=<atable>
An atable to be searched within callback procedures for this window. This means that any
identifiers within <atable>
referenced in a callback do not have to be prefixed by ~<atable>. This cannot be the
local atable.
-bc=<color>
The background color of the tree display area. If omitted, a default color is used.
-ch
Add check boxes to nodes within the tree. The default behavior is to
omit check boxes.
-col=<color>
The color of the
window excluding the tree display area. If omitted, a default color is
used.
-cr=<file(s)>
A string array containing a list of image files. These can then be referenced by number
within the associated tree node data to indicate the image for each tree
node.
This option is valid only for simple trees and is ignored otherwise. All images are displayed with the same pixel dimensions, defined by the -pix switch (default 16 x 16). Images which have different dimensions are scaled accordingly.
-dec=<n>
A specification of the window decoration to be added by the window manager.
Possible values are:
0 (or -no_dec) for no decoration at all,
1 for full decoration (the default),
>1 for custom decoration, see Window Decoration.
-dim=<screen_xy>
Define the dimensions of the tree area in pixels. This is a two element array.
-emb=<string>
Embed the window into a container provided by an external client. <string> is the name of an
embed container created by the embed command.
If the embed container does not exist or is invalid, this switch is ignored.
-fix
Open the window fixed size, i.e. non-resizable. The default is the value
of <window>.resizable.
-fo=<font>
The font to be used when displaying printable characters in the window.
This must be a fixed font. If omitted, a default fixed font is used.
-geo=<screen_box>
The geometry of the window in screen coordinates, either just its position (a two element
array) or its full rectangle geometry (a four element array). The default
is the value of <window>.outrect.
-gh
The window should be initially ghosted, i.e. insensitive to user-interaction.
The default is the value of <window>.ghosted.
-ic
Open the window in iconic form. The default is the value of <window>.open.
-inv
Open the window invisible. The default is the value of <window>.visibility.
-mas
Define the window as a master window. When a master window is iconized,
this also iconizes all other windows.
-mb
Give the window a menubar for user buttons. If omitted, the window
will be created without a menubar.
-mf=<font>
The font to be used for menubar text. This must be a fixed font. If omitted
a default fixed font is used. This option has no effect on Windows systems,
where menubar font and color are controlled by the window manager.
-num
Include the window slot number in the window's title. Use -no_num
to suppress it. The default behavior is governed by the value of the system
numeric window_numbers.
-ocol=<color>
The other color for use in the window, excluding the text display area, e.g. for button
text. If omitted, a default color is used.
-pix=<xy>
The pixel dimensions for images. If omitted dimensions 16 x 16 are used. All images will be
displayed with these dimensions, scaled if necessary.
-pos=<screen_xy>
The position of the window in screen coordinates. This is a two element array. The
default is the value of <window>.outrect[1:2].
-sc
Give the window scrollbars. This is the default. If scrollbars are not
required use -no_sc.
-sh=<string>
A shell name for
communication with X application resources. If omitted, the value alpha is used.
-tb
Display the window icon in the Windows taskbar. The default behavior is
not to display it in the taskbar but only to display it on the desktop when
minimized. This switch has no meaning on Unix systems.
-tc=<color>
Define the default color of text labels the tree display. If omitted, the default foreground
color (usually black) is assumed.
-tit=<string>
Provide a title for the window. The default is the value of <window>.title.
Required only for simple trees, this contains a declaration of all initial nodes in the tree. All nodes will be of class <type>.
The data is a series of lines each containing a string (the node label) and an image number (see the -cr switch). { and } are used to mark the parent/child relationships, e.g.
node_1,1 { node_1_child_1,2 node_1_child_2,2 node_1_child_3,2 { node_1_child_3_child_1,3 node_1_child_3_child_2,3 } } node_2,1 node_3,1 { node_3_child_1,4 }
For dynamic trees, and for further population of simple trees, additional nodes can be added to the tree by a window function window.add_node.
The tree is displayed as a left-to-right pictorial hierarchy, each node being displayed with its image and text. If the node is a parent node it also has a +/- symbol beside it to indicate that the node can be expanded or contracted to display its children. Double-clicking on the +/- expands or contracts a parent node as appropriate.
Each node is an instance of a treenode class, which defines the behavior of the node when the user interacts with it. There are callbacks associated with a class which when invoked can dynamically populate, de-populate nodes, take action on node selection/de-selection, or can add more nodes to the tree. Treenode classes are created by the treenode_define command. Refer to this command for more information.
Define a class of treenode with default behavior.
atable test treenode_define ~test.person_t { }
Define an array of images to use.
string images[] = <'male.xpm','female.xpm','family.xpm'>
Create a simple family tree.
window my_win = wtree ~test.person_t,-cr=images,\ -pix=<32,32> { 'Pinnington',3 { 'Jim',1 { 'Linda',2 'Andrew',1 'Susan',2 } 'Jack',1 'Ella',2 'Jesse',2 } 'Wright',1 { 'Leonard',1 { 'Peter',1 } 'Herbert',1 { 'Neil',1 'Brenda',2 'David',1 } 'Vera',2 } }
Commands: |
color, embed, treenode, treenode_define, wclose, window, wopen, wsize |
Identifiers: |
free_window (window), new_window (window), win# (window), window_numbers (numeric) |
Structures: |