File 'gui/valueman.cls' (part of 'Pool_GuiBase')

Description (short)
value management (-value, -command, -variable), as in Tix
Written by
Andreas Kupries
Description
management for options -value, -variable and -command of a widget using a single value. Actually snarfed from Tix and adapted to our oo system.
Keywords
value management, -value, -variable, -command, widgets

Class 'valueManager'

Description
Defines and manages the options '-value', '-variable', '-command' and their interactions. Derived classes must provide a method 'updateDisplay'. It will be called after changes to the value and has to refresh the shown information according to the changed value.
Superclasses
widget
Options
command
value
variable
Methods
public
ExecuteCmd ()
InitializeManager ()
TrackValue (o oldValue)
TrackVarContents (var idx op)
TrackVariable (o oldValue)
UpdateVariable ()
updateDisplay ()
valueManager ()
~valueManager ()

Options

-command
Script to evaluate after changes to the value. A single argument is appended, it contains the new value given to the widget.
-value
The value managed by instances of this class and all its derived classes.
-variable
Name of the (global) variable associated to the widget. Any changes to its contents are propagated into the widget and vice versa.

Methods

ExecuteCmd ()

Executes the tcl script associated to changes of the widget value, if defined.
Notes: Technicalities as in UpdateVariable.

InitializeManager ()

Special method, is called after the completion of the construction of widget and its components. Initializes the value of the widget according to the contents of the associated variable, if defined.

TrackValue (o oldValue)

Configure procedure. Internal method used to track changes made to the contents of option '-value'. Updates the associated global variable, executes the specified command, then shows the new value in the display. As both setting the -variable and execution of the -command are allowed to change the -value this order must not be changed or else we will be left with an inaccurate display.
Argument: o The name of the changed option.
Argument: oldValue The value of the option before the change.

TrackVarContents (var idx op)

Internal trace callback to monitor the value of the variable associated to the widget.
Argument: var Standard trace argument, base name of traced variable
Argument: idx Standard trace argument, index of traced variable, if an array item
Argument: op Standard trace argument, operation invoking the trace.

TrackVariable (o oldValue)

Configure procedure. Used to track changes to the value of -variable. Removes the traces set upon the old associated variable, then links in the new variable and its contents.
Argument: o The name of the changed option.
Argument: oldValue The value of the option before the change.

UpdateVariable ()

Called after changes to the value. Updates the associated global variable, if defined.
Notes: Some technicalities to note:
The internal trace is temporarily removed to avoid a (possibly infinite) recursive invocation of traces. The value of the global variable is reread after its setting to catch restrictions made by other traces.
The code is originally from Tix, and was modified to fit into this oo framework.

updateDisplay ()

Dummy method, must be overridden by derived classes. This one will only throw an error.

valueManager ()

Special constructor. Schedules the execution of the real initialization to happen after the standard initialization and the creation of all component widgets of the derived class.

~valueManager ()

Special destructor. Removes the association between the widget and the variable specified in '-variable', if the latter is not empty. This is accomplished through the deletion of the variable trace set earlier by this widget.


Generated by AutoDoc 2.4 at 09/14/2000, invoked by Andreas Kupries