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
* menu_item's sensitivity is reset.
*/
XtAddCallback (XtParent(dialog), /* dialog's _parent_ */
XmNpopdownCallback, reset_sensitive, menu_item);
XtAddCallback (dialog, XmNdestroyCallback, reset_sensitive, menu_item);
XtManageChild (dialog);
XtPopup (XtParent (dialog), XtGrabNone);
}
The open_callback() function is called whenever the user activates the Open menu item on the File menu. The
first thing open_callback() does is find the nearest WMShell widget associated with the menu item. We do not
want the MenuShell here, as we need a non−transient widget to act as the parent for the FileSelectionDialog. If the
menu item is used as the parent for the dialog, when the menu is popped down, the dialog is also popped down
because it is a secondary window.
We set the menu item's sensitivity to False, which prevents the user from selecting the item again. In order to be
notified when the FileSelectionDialog is dismissed, we add callback routines for XmNpopdownCallback and
XmNdestroyCallback. In both cases, the Open menu item needs to be reset so that the user can select it again.
The only thing in open_callback() is a callback function that opens the selected file when the user selects the
OK button. This functionality is beyond the scope of this chapter; see Chapter 6, Selection Dialogs, for details.
16.3.7 Tear−Off Menus
Motif 1.2 provides a new feature that allows menus to be torn off and placed in separate windows. From the user's
perspective, tear−off menus make it easy to make repeated menu ...
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