Callback data structure
Every callback procedure gets passed
a Tcl keyed list of callback data as its last argument.
A keyed list is a list
in which each element contains a key and value pair (see the
``Keyed lists (TCLX)''
for further details).
TclX provides commands to access and manipulate keyed lists.
This keyed list contains information about the widget that
invoked the callback and will minimally contain these
keys:
Some additional widget-specific callback keys are provided for backward compatibility with earlier versions of SCO Visual Tcl. They are surrounded by brackets where they appear in the text. Use of these keys is deprecated; they may be withdrawn from a future release of SCO Visual Tcl.
To get access to the data corresponding to a key, use the
command keylget. For example, to get access to the button which
caused a pushbutton callback and the value passed to the callback,
this code might be used:
proc buttonCB {cbs} { set button [keylget cbs widget] set value [keylget cbs value] }If a callback has additional arguments other than those passed in automatically by the callback structure, declare the arguments first and then declare the callback structure (which is typically referred to as cbs):
proc buttonCB {arg1 arg2 arg3 cbs} { set button [keylget cbs widget] } . . . VtPushButton $parent.btn -callback "buttonCB $par1 $par2 $par3"The following tables show the value for the ``mode'' key for various widgets in response to various stimuli.
Value of ``mode'' keyedList field in graphical mode
------------------------------------------------------------------------------------------------- widget done select change selectSame internalTraverse ------------------------------------------------------------------------------------------------- Text RETURN N/A Chg+LF N/A N/A (single line) Combo RETURN N/A Chg+LF N/A N/A (in combotext widget) OptMenu RETURN SPACE/MB1 N/A N/A N/A (in droplist) CheckBox N/A(∗ ) SPACE/MB1 N/A N/A N/A RadioBox N/A(∗ ) SPACE/MB1 N/A N/A N/A PushBtn N/A(∗ ) SPACE/MB1 N/A N/A N/A Scale N/A MB1 Arrows N/A N/A ToggleBtn N/A(∗ ) SPACE/MB1 N/A SPACE/MB1 N/A (and selected value) list N/A(1) SPACE/MB1 N/A N/A Up/Dwn Arrow drawnList N/A(?) MB1 N/A N/A Up/Dwn Arrow SPACE ( while in dlist)
Value of ``mode'' keyedList value with CHARM Server
------------------------------------------------------------------------------------------- widget done select change selectSame internalTraverse ------------------------------------------------------------------------------------------- Text RETURN N/A Chg+LF N/A N/A (single line) Combo RETURN N/A Chg+LF N/A N/A (in combotext widget) OptMenu RETURN SPACE N/A N/A N/A (in droplist) CheckBox RETURN SPACE N/A N/A N/A RadioBox RETURN SPACE N/A N/A N/A PushBtn RETURN SPACE N/A N/A N/A Scale N/A N/A Arrows N/A N/A ToggleBtn RETURN SPACE N/A SPACE N/A (and selected value) list RETURN SPACE N/A N/A N/A(?) drawnList RETURN SPACE N/A N/A N/A(?)