|
|
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. SCO Visual Tcl provides commands to delete, get, list, and set keys: keyldel(1tcl), keylget(1tcl), keylkeys(1tcl), keylset(1tcl). This keyed list contains information about the widget that invoked the callback and minimally contains the following keys:
To access the data corresponding to a key, use
keylget(1tcl).
For example, to access the button which
caused a pushButton callback and the value passed to the callback,
use code like the following:
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 actions.
Value of ``mode'' keyedList value 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 |
| (while in list) | |||||
| drawnList | N/A(1) | 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(?) |