Name
XtMenuPopup — built-in action for popping up a widget.
Synopsis
void XtMenuPopup(shell_name)
String shell_name;
Arguments
shell_name
Specifies the name of the widget shell to pop up.
Description
XtMenuPopup (and its synonym MenuPopup) is a built-in action that pops up a widget. XtMenuPopup must be specified in a translation for ButtonPress, KeyPress, or an EnterWindow event.
XtMenuPopup is known to the Translation Manager, which registers the corresponding built-in action procedure XtMenuPopupAction. This action procedure uses an XtRegisterGrabAction routine with:
•
owner_events set to True.
•event_mask set to ButtonPressMask | ButtonReleaseMask.
•pointer_mode and keyboard_mode set to GrabModeAsync.
If XtMenuPopup is invoked on ButtonPress, it calls XtPopupSpringLoaded on the specified shell widget. If XtMenuPopup is invoked on KeyPress or EnterWindow, it calls XtPopup on the specified shell widget with grab_kind set to XtGrabNonexclusive. Otherwise, the translation manager generates a warning message and ignores the action.
When the widget is popped up, XtMenuPopup performs the following actions:
•Calls XtCheckSubclass to ensure popup_shell is a subclass of Shell.
•Returns if the shell’s popped_up field is already True.
•Calls the callback procedures on the shell’s popup_callback list.
•Sets the shell popped_up field to True and the shell grab_kind and spring_loaded fields appropriately.
•If the shell’s create_popup_child field is non-NULL, it is called with popup_shell as the parameter.
•Calls:
XtAddGrab(popup_shell, (grab_kind == XtGrabExclusive),
spring_loaded)
•Calls XtRealizeWidget with popup_shell specified.
•Calls XMapRaised with popup_shell specified.
(Note that these steps are the same as those for XtPopup.) XtMenuPopup tries to find the shell by searching the widget tree starting at the parent of the widget in which it is invoked. If it finds a shell with the specified name in the pop-up children of that parent, it pops up the shell with the appropriate parameters. Otherwise, it moves up the parent chain as needed. If XtMenuPopup gets to the application widget and cannot find a matching shell, it generates a warning and returns immediately.
See Also
XtMenuPopdown(1), XtPopDown(1), XtPopup(1), XtPopupSpringLoaded(1).