Specifications

Athena Widget Set libXaw 1.0.7
void XtAddCallback(w, callback_name,callback, client_data)
Widget w;
String callback_name;
XtCallbackProc callback;
XtPointer client_data;
w Specifies the widget to add the callback to.
callback_name Specifies the callback list within the widget to append to.
callback Specifies the callback procedure to add.
client_data Specifies the data to be passed to the callback when it is invoked.
XtAddCallback adds the specified callback to the list for the named widget.
All widgets provide a callback list named destroyCallback where clients can register procedures
that are to be executed when the widget is destroyed. The destroycallbacks are executed when
the widget or an ancestor is destroyed. The call_data argument is unused for destroycallbacks.
2.10. Programming Considerations
This section provides some guidelines on howtoset up an application program that uses the X
Toolkit.
2.10.1. Writing Applications
When writing an application that uses the X Toolkit, you should makesure that your application
performs the following:
1. Include <X11/Intrinsic.h>inyour application programs. This header file automatically
includes <X11/Xlib.h>, so all Xlib functions also are defined. It may also be necessary to
include <X11/StringDefs.h > when setting up argument lists, as manyofthe XtNsome-
thing definitions are only defined in this file.
2. Include the widget-specific header files for each widget type that you need to use. For
example, <X11/Xaw/Label.h>and <X11/Xaw/Command.h>.
3. Call the XtAppInitialize function before invoking anyother toolkit or Xlib functions. For
further information, see Section 2.1 and the XToolkit Intrinsics — C Language Interface.
4. Topass attributes to the widget creation routines that will override anysite or user cus-
tomizations, set up argument lists. In this document, a list of valid argument names is pro-
vided in the discussion of each widget. The names each have a global symbol defined that
begins with XtN to help catch spelling errors. Forexample, XtNlabel is defined for the
label resource of manywidgets.
Forfurther information, see Section 2.9.2.2.
5. When the argument list is set up, create the widget with the XtCreateManagedWidget
function. For further information, see Section 2.2 and the XToolkit Intrinsics — C Lan-
guage Interface.
6. If the widget has anycallback routines, set by the XtNcallback argument or the XtAdd-
Callback function, declare these routines within the application.
7. After creating the initial widget hierarchy, windows must be created for each widget by
calling XtRealizeWidget on the top levelwidget.
8. Most applications nowsit in a loop processing events using XtAppMainLoop,for exam-
ple:
XtCreateManagedWidget(name, class, parent, args, num_args);
XtRealizeWidget(shell);
XtAppMainLoop(app_context);
13