Skip to Main Content
Volume 6A: Motif Programming Manual
book

Volume 6A: Motif Programming Manual

by David Brennan, Dan Heller, Paula Ferguson
September 1993
Intermediate to advanced content levelIntermediate to advanced
1014 pages
28h 26m
English
O'Reilly Media, Inc.
Content preview from Volume 6A: Motif Programming Manual
Widget dialog = NULL;
/* first see if this menu item's dialog has been created yet */
XtVaGetValues(w, XmNuserData, &dialog, NULL);
if (!dialog) {
/* menu item hasn't been chosen yet −− create the dialog.
* Use the toplevel as the parent because we don't want the
* parent of a dialog to be a menu item.
*/
dialog = (*func)(toplevel, "dialog", NULL, 0);
XtVaSetValues (XtParent (dialog), XmNtitle, XtName (w), NULL);
XtVaSetValues (dialog, XmNautoUnmanage, True, NULL);
/* store the newly created dialog in the XmNuserData for the menu
* item for easy retrieval next time. (see get−values above.)
*/
XtVaSetValues (w, XmNuserData, dialog, NULL);
}
XtManageChild (dialog);
XtPopup (XtParent (dialog), XtGrabNone);
/* If the dialog was already open, XtPopup does nothing. In
* this case, at least make sure the window is raised to the top
* of the window tree (or as high as it can get).
*/
XRaiseWindow (XtDisplay (dialog), XtWindow (XtParent (dialog)));
}
The output of the program is shown in the figure.
Output of popups.c
The program displays two PushButtons, one of which is a gadget and the other a widget. We get the ButtonPress
event by specifically asking for it using XtAddEventHandler(). This routine requires a widget because it needs a
window. To add an event handler for a gadget, you would have to install it on the gadget's parent, which is a manager
widget. Anytime a ButtonPress event occurs ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Volume 7A: XView Programming Manual

Volume 7A: XView Programming Manual

Dan Heller

Publisher Resources

ISBN: 9780596000431