Using callbacks and procedures

Using callbacks and procedures

Callbacks are messages sent from the server back to the interpreter in response to an action (user input, widget activation, or errors, for example) that calls a Tcl command or procedure.

Each callback specifies a command or named procedure to execute in response to some event -- the exact event is dependent on the callback name and the widget.

When executed, a ``callback structure'' is appended to the given command string and the entire string is passed to the interpreter for evaluation.

Callbacks can be set when the widget is created, or at any time after creation. Once set, a callback can be reset. Resetting an existing callback replaces any prior callback settings for that widget.

Callbacks are a specialized form of a ``procedure''; a section of code which accomplishes a particular task, such as refreshing a list of items or killing a selected process.

The remainder of this chapter discusses the callback data structure and keyed lists, and other defined callbacks and their associated keywords.

For samples of callbacks and procedures, see the various ones defined in Chapter 2, for example ``Creating the process list (VtList, VxSetVar)'' and ``Getting the process ID (MenuKillCB)''.

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 02 June 2005