Tornado API Reference : GUI Tcl Library (UNIX)
motifHierarchy - Tcl interface and managament of Motif HierarcyView objects
hierarchyCreate - create a hierarchy window
hierarchyPost - post a hierarchy
hierarchyDestroy - destroy a hierarchy
hierarchyExists - test for the existence of a hierarchy
hierarchyList - return a list of all existing hierarchies
hierarchyIsDisplayed - check if a hierarchy window is displayed
hierarchySetStructure - set the structure of a hierarchy
hierarchySetValues - set the values of terminal nodes in a hierarchy
hierarchyHighlight - highlight a given node in a hierarchy
hierarchyUnhighlight - highlight a given node in a hierarchy
This library allows to manipulate motif HierarchyView objects for Tcl UNIX GUI
hierarchyCreate - create a hierarchy window
UNIX GUI
hierarchyCreate [-destroy proc] [-change] [-special] name [callback]
A new hierarchy window is created with the specified name. Before it can be seen, a hierarchy must be configured with hierarchySetStructure (and possibly hierarchySetValues) and posted with hierarchyPost.
The -change flag requests that the hierarchy highlight values that have changed from one evaluation to the next. The -special flag limits the applicability of the callback: clicking on any hierarchy item invokes the callback unless the -special flag is set; setting -special means that only items marked as traversable (by the string "*:" in the structure item name) invoke the callback when clicked.
If -destroy is given, proc is used as the name of a Tcl procedure that is invoked if the hierarchy window is destroyed by the user. The procedure is invoked with one argument: the name of the hierarchy window.
motifHierarchy, hierarchySetStructure, hierarchySetValues, hierarchyPost, hierarchyDestroy
hierarchyPost - post a hierarchy
UNIX GUI
hierarchyPost name
The named hierarchy is posted, making it visible on the display. It is not an error to attempt to post a nonexistent hierarchy.
motifHierarchy, hierarchyCreate
hierarchyDestroy - destroy a hierarchy
UNIX GUI
hierarchyDestroy name
The named hierarchy is completely destroyed; it is removed from the screen and its definition forgotten.
motifHierarchy, hierarchyCreate
hierarchyExists - test for the existence of a hierarchy
UNIX GUI
hierarchyExists name
This function tests for the existence of a specified hierarchy.
1 if the named hierarchy exists, 0 otherwise.
motifHierarchy, hierarchyList, hierarchyCreate
hierarchyList - return a list of all existing hierarchies
UNIX GUI
hierarchyList
This function returns a list of the names of all existing hierarchies.
motifHierarchy, hierarchyCreate, hierarchyPost, hierarchyExists
hierarchyIsDisplayed - check if a hierarchy window is displayed
UNIX GUI
hierarchyIsDisplayed name
This function checks to see if the specified window is displayed.
1 if the hierarchy is currently visible (posted and not iconified), 0 otherwise.
motifHierarchy, hierarchyPost, hierarchyCreate, hierarchyExists
hierarchySetStructure - set the structure of a hierarchy
UNIX GUI
hierarchySetStructure name structure
A hierarchy is set to contain a list of names, each of which itself may contain a vector of subordinate names. These named entries in a hierarchy are called "nodes". A node is called "terminal" if it does not have subordinate nodes. Any terminal node may also be given an associated value by the command hierarchySetValues. The structure of a hierarchy is a nested list in Tcl syntax. Each item represents a node. If an item is itself a list of exactly two elements, the first element represents the name of the node, and the second element is taken as a list of subnodes. For example, the "structure string"
A {B {b1 b2}} C D {E {{e1 {e11 e12 e13}} e2}} Frepresents this hierarchy:
A - B b1 b2 C D - E - e1 e11 e12 e13 e2 F(The - flags indicate that the node is considered "expandable", because it contains children. This is usually marked in a displayed hierarchy as an "open folder" icon.)There is a subtlety in the syntax of a hierarchy structure string: nodes that have two list elements represent nodes with children, while nodes with one or more than two elements represent single terminal nodes. Hence, the structure string
A {hi there} Crepresents the hierarchy
A - hi there CIf "hi there" is meant to be a simple node parallel with A and C, it must be written with either one or more than two elements, e.g.:
A {hi-there} C
At any time hierarchySetValues can be called, which fills in the value strings of the terminal nodes with strings from the supplied value list. If the first hierarchy given above had hierarchySetValues invoked with the following string
1 {2 3} 4 5 {{6 7 8} 9} 10The values would be assigned as follows:
A = 1 - B b1 = 2 b2 = 3 C = 4 D = 5 - E - e1 e11 = 6 e12 = 7 e13 = 8 e2 = 9 F = 10Note that only terminal nodes can receive values, and that the list structure of the value string mirrors that of the structure string.
It is possible for a node to be marked as an "array node". In this case, the second element of the structure for the node uses the special name "+". If the subnode is simply named "+", the array is a simple array of terminal values. When values are assigned to array nodes, the number of items in the value list becomes the number of children of the array node. This number can grow or shrink. Given the structure string
A {B +}and the value string
v {w x y z}the resulting hierarchy is:
A = v - B 0 = w 1 = x 2 = y 3 = zChild nodes of B are automatically created and given names starting with "0". Supplying another value string "v {a b}" would reduce the number of elements subordinate to B to 2.The array constructor "+" can be nested: the structure/value pair
{A {+ {+}}} {{1 2} {3 4} {5 6}}results in the "two dimensional array" hierarchy
- A - 0 0 = 1 1 = 2 - 1 0 = 3 1 = 4 - 2 0 = 5 1 = 6
Arrays can also have substructure. This is indicated by replacing "+" with a two-element list, where the first element is "+" and the second is a structure string representing the array substructure. For an array of structures, each having a member "n" and a substructure member "coord", with members "x" and "y", one could write for structure and value:
{Point {+ {n {coord {x y}}}}} {{1 {2 3}} {4 {5 6}}}Yielding:
- Point - 0 n = 1 - coord x = 2 y = 3 - 1 n = 4 - coord x = 5 y = 6
motifHierarchy, hierarchySetValues, hierarchyCreate
hierarchySetValues - set the values of terminal nodes in a hierarchy
UNIX GUI
hierarchySetValues name value
The named hierarchy has its terminal node values set according to the structured list value. See the documentation for hierarchySetStructure for a discussion of hierarchy values.
motifHierarchy, hierarchySetStructure, hierarchyCreate
hierarchyHighlight - highlight a given node in a hierarchy
UNIX GUI
hierarchyHighlight name path
Within the named hierarchy, the terminal node described by path is highlighted. Path is a list of node names that describes the chain of nodes starting with the root node of the hierarchy. More than one node in a hierarchy can be highlighted. Nonterminal nodes cannot be highlighted.
Suppose the structure string of the hierarchy named c is:
{fruit {apple cherry}} {vegetable {carrot onion}}To highlight the carrot node one would issue the command:
hierarchyHighlight c {vegetable carrot}
motifHierarchy, hierarchyUnhighlight, hierarchyCreate, hierarchySetStructure
hierarchyUnhighlight - highlight a given node in a hierarchy
UNIX GUI
hierarchyUnhighlight name path
This command undoes the work of hierarchyHighlight. See that command for a description of the arguments to this one.
motifHierarchy, hierarchyHighlight, hierarchyCreate, hierarchySetStructure