package require EVBUtilities
EVB::utility::sortedWidget window ?options?
$window configure options
$window cget ?option-name?
$window listids
$window getWidget id
$window update id value
$window reset
This provides a widget that is a generalized version of ::EVB::utility::sortedPair. Where EVB::utility::sortedPair provides a pair of labels, this widget provides for the use of an aribtray widget in place of the label. (actually EVB::utility::sortedPair is implemented in terms of this widget).
A bit of discussion is in order. In order for this widget to work, the client must supply callback scripts (see OPTIONS below). These callback scripts are called to create a value widget, set its internal state and optionally take action just prior to the destruction of a value widget.
-title
Provides a title for the entire widget.
-lefttitle
Provides a title for the left column of the widget pair.
-righttitle
Provides a title for the right column of the widget.
-create
Provides a callback script that is called when a new right side widget needs to be created. The desired window name and corresponding key are appended to this script fragment in that order.
If this script is not defined at the time the first new widget must be created, an error is thrown.
-update
Provides a callback script that is called when a right side widget must be updated. The widget and the value from the update method are appended, in that order, to the script.
If this script is not defined at the time the state of a right column widget needs to be filled in, an error will be thrown.
-destroy
Provides an optional script that is called just prior to the destruction of a right side widget. It is legal to not define this script. You only need to supply it if you are maintaining state external to the widget itself that needs to be cleaned up.
The window name and the key id value are both appended to the script in that order.
The configure and cget methods operate just like all the corresponding methods for Tk widgets.
$window listids
Lists the set of key (id) values that are currently defined for the widget. These are all the ids for which update was called since the most recent reset call.
$window getWidget id
Gets the widget associated with
the key id
.
If id
does not yet exist,
an error is thrown.
$window update id value
Updates the widget associated with the key id
in the manner dictated by the value
.
If there is not yet a widget for id
the -create
script is first called
to create it.
The actual widget update is accomplished by invoking the
-update
script. If more than one
piece of information is required you can pass
a list for value
.
$window reset
Destroys all the id/widget pairs. For each widget,
just prior to its destruction, the
-destroy
script is invoked,
if it has been defined.