In order to DO anything with the pushbutton, we need to make use of its callbacks. An event might be, in this case, the user pushing the button. We will look at why this works, and then look at extensions to the idea. This program starts by setting up the pushbutton widget, as in the first program. The new XtAddCallback line is the only difference.
Any callback function receives three pieces of information when it is called.
If you are using an ANSI C compiler, the compiler will complain about type problems when you try to pass client data in this manner. In the call to XtAddCallback, cast the value you pass to the type XtPointer as well.