next up previous contents
Next: xviewfile Up: Example Programs Previous: Program Listing of

Program Listing Of Motif Version Of xbutton

/* xbutton.c - a very simple X Toolkit application, Jeff Pitchers, LUT 1993 */
/* Motif Toolkit version */

/* Include the necessary Motif Toolkit header files */
#include <Xm/Xm.h>
#include <Xm/PushB.h>

main(argc, argv)
int argc; char **argv;
{
  XtAppContext ac;
  Widget top, button;
  int Stop();

  top = XtVaAppInitialize(&ac, "XButton", NULL, 0, &argc, argv, NULL, NULL);
  button = XtVaCreateManagedWidget("quit", xmPushButtonWidgetClass, top, NULL);
  XtAddCallback(button, XmNactivateCallback, Stop, NULL);
  XtRealizeWidget(top);
  XtAppMainLoop(ac);
}

/* Callback routine when button is clicked */
/* ARGSUSED */
Stop(w, a, b)
Widget w; XtPointer a, b;
{
  exit(0);
}

 
Figure 20: The Motif version of xbutton



JR Pitchers
Wed May 3 16:45:04 BST 1995