# IupPopup

Definition: | include pGUI.e IupPopup(Ihandle ih, integer x=IUP_CURRENT, y=IUP_CURRENT)
Description: | Shows a dialog or menu and restricts user interaction only to the specified element. It is equivalent of creating a Modal dialog is some toolkits. ih: Identifier of a dialog or a menu. x: horizontal position of the top left corner of the window or menu, relative to the origin of the main screen. The following definitions can also be used: 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. Not valid for menus. (Since 3.0) IUP_CURRENT: use the current position of the dialog. Not valid for menus. (Since 3.0) IUP_LEFTPARENT: Positions the element on the left border of its parent. Not valid for menus. (Since 3.29) IUP_RIGHTPARENT: Positions the element on the right border of its parent. Not valid for menus. (Since 3.29) y: vertical position of the top left corner of the window or menu, relative to the origin of the main screen. The following definitions can also be used: 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. Not valid for menus. (Since 3.0) IUP_CURRENT: use the current position of the dialog. Not valid for menus. (Since 3.0) IUP_TOPPARENT: Positions the element on the top border of its parent. Not valid for menus. (Since 3.29) IUP_BOTTOMPARENT: Positions the element on the bottom border of its parent. Not valid for menus. (Since 3.29)
pwa/p2js: | Not supported. (On the list, though may prove so awkward as to not be worthwhile.)
Comments: | 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 (even if they were disabled by the Popup, calling IupShow will re-enable the dialog because it will change its popup level). IMPORTANT: The popup levels must be closed in the reverse order they were created or unpredictable results will occur. PL: I have also found that `IupHide(x);IupMessage();` from within an `IupPopup(x);` fails badly, presumably the IupHide signals the end of a popup level but the IupMessage fouls that up - the message was not shown and the IupDialog x became permanently disabled. (I fixed things by setting a flag and displaying the IupMessage after it had returned from IupPopup.) 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 example 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 also ends the current popup level dialog.
Notes: | It will call IupMap for the element. The x and y values are the same as returned by the SCREENPOSITION attribute. IUP_MOUSEPOS position is the same as if the global attribute CURSORPOS was used to obtain x,y values. See the PLACEMENT attribute for other position and show options. When IUP_CENTERPARENT is used but PARENTDIALOG is not defined then it is replaced by IUP_CENTER. When IUP_CURRENT is used at the first time the dialog is shown then it will be replaced by IUP_CENTERPARENT. The main screen size does not include additional monitors. IupPopup works just like IupShow and IupShowXY, but it inhibits interaction with other dialogs that are visible and interrupts the processing until IUP_CLOSE is returned in a callback, IupExitLoop is called, or the popup dialog is hidden. Although it interrupts the processing, it does not destroy the dialog when it ends. To destroy the dialog, IupDestroy must be called. 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.
See Also: | IupShow, IupShowXY, IupHide, IupMap