The function Arm(), Disarm() and Activate() are examples of predefined callback functions.
For any program X/Motif will provide the GUI.
The Main body of the application will be attached to the GUI and functions called from various events within the GUI.
To do this in Motif we have to add our own callback functions.
In push.c we have a function pushed_fn() which prints to standard output.
The function XtAddCallback() is the most commonly used function to attach a function to a widget.
It has four arguments:
In addition to performing a job like highlighting the widget, each event action can also call a program function. So we can also hang functions off the arm, disarm etc. actions as well. We use XmNarmCallback, XmNdisarmCallback names to do this.
So if we wanted to attach a function quit() to a disarm for the button widget, we would do:
XtAddCallback(button, XmNdisarmCallback, quit, NULL);