Callbacks

Callbacks are application procedures which are called in response to events within the user interface.

X-Designer does not automatically generate any callback procedures for widgets - it is the responsibility of the application programmer to provide such functionality.

The only exception to this rule is in the case of links, in which case a callback will be generated for each link before the widget creation procedures.

X-Designer can, however, register the callbacks you have defined for widgets into their callback lists. To allow these to be called, X-Designer generates external declarations of the callback procedures you have defined.

When writing callback procedures, the definition of each procedure must match the description given in the OSF/Motif Programmer's Guide for each particular callback. For example, if you have defined an activate callback for a push button as button_pressed(), your callback must be defined in the form:


void button_pressed(w, client_data, call_data) Widget w; XtPointer client_data; XmPushButtonCallbackStruct *call_data; { /* APPLICATION CODE HERE */ }

Alternatively, the call_data can be declared XmAnyCallbackStruct *. You must however cast this to an appropriate type when accessing the callback specific data.

Further information on callbacks can be found within the OSF/Motif Programmer's Reference.

You can search for a callback name (or a string in a callback name) through all the widgets in your design by using search facility.

HINTS

You can ask X-Designer to generate a template for each of the callback procedures in the interface using the Generate Stubs option within the code generation dialog. The body of such procedures is your responsibility.

See also: