IupPopup
Shows a dialog or menu and restricts user interaction only to the specified element. It is equivalent of creating a Modal dialog is some tooklits.
If another dialog is shown after IupPopup using IupShow, then its interaction will not be inhibited. Every IupPopup call creates a new popup level that inhibits all previous dialogs interactions, but does not disable new ones. IMPORTANT: The popup levels must be closed in the reverse order they were created or unpredictable results will occur.
For a dialog this function will only return the control to the application after a callback returns IUP_CLOSE, IupExitLoop is called, or when the popup dialog is hidden, for exemple using IupHide. For a menu it returns automatically after a menu item is selected. IMPORTANT: If a menu item callback returns IUP_CLOSE, it will ends the current popup level dialog.
Parameters/Return
int IupPopup(Ihandle *ih, int x, int y); [in C] iup.Popup(ih: ihandle[, x, y: number]) -> (ret: number) [in Lua] or ih:popup([x, y: number]) -> (ret: number) [in Lua]
ih: Identifier of a dialog or a menu.
x: X coordinate of the left corner of the interface element. The following macros are
valid:
- IUP_LEFT: Positions the element on the left corner of the screen
- IUP_CENTER: Centers the element on the screen
- IUP_RIGHT: Positions the element on the right corner of the screen
- IUP_MOUSEPOS: Positions the element on the mouse cursor
- IUP_CENTERPARENT: Horizontally centralizes the dialog relative to its parent (Since 3.0)
- IUP_CURRENT: use the current position of the dialog (if used at the first time the dialog is shown, then it is replaced by IUP_CENTERPARENT if PARENTDIALOG is defined or simply by IUP_CENTER). This is the default value in Lua if the parameter is not defined or nil. (Since 3.0)
y: Y coordinate of the upper part of the interface element. The following macros are valid:
- IUP_TOP: Positions the element on the top of the screen
- IUP_CENTER: Vertically centers the element on the screen
- IUP_BOTTOM: Positions the element on the base of the screen
- IUP_MOUSEPOS: Positions the element on the mouse cursor
- IUP_CENTERPARENT: Vertically centralizes the dialog relative to its parent (Since 3.0)
- IUP_CURRENT: use the current position of the dialog (if used at the first time the dialog is shown, then it is replaced by IUP_CENTERPARENT if PARENTDIALOG is defined or simply by IUP_CENTER). This is the default value in Lua if the parameter is not defined or nil. (Since 3.0)
This function returns IUP_NOERROR if sucessful. Returns IUP_INVALID if not a dialog or menu. If there was an error returns IUP_ERROR..
Notes
Will call IupMap for the element.
See the PLACEMENT attribute for other position and show options.
IupPopup works just like IupShow and IupShowXY, but it inhibits interaction with other dialogs and interrupts the processing until IUP_CLOSE is returned in a callback or the dialog is hidden. Althougth it interrupts the processing, it does not destroy the dialog when it ends. To destroy the dialog, IupDestroy must be called.
This function can be executed more than once for the same dialog. IMPORTANT: Calling IupPopup for an already visible dialog will only update its position and/or size on screen, will NOT change its modal state and will NOT interrupt processing.
In GTK and Motif the inactive dialogs will still be able to move, resize and change their Z-order. Although their contents will be inactive, keyboard will be disabled, and they can not be closed from the close box.