IUP/Controls/IupDialog

From Vendetta Lua
Jump to navigationJump to search


Controls

Dialog
Fill
Hbox
Vbox
Zbox
Cbox
Radio
Button
Canvas
Frame
Label
List
Multiline
Text
Toggle
Progress Bar
Matrix
Tree
Navmap

Creates a dialog element. It manages user interaction with the interface elements. For any interface element to be shown, it must be encapsulated in a dialog.

Creation

   iup.dialog{element: ihandle} -> (elem: ihandle)
element: Identifier of an interface element.
This function returns the identifier of the created dialog, or NULL if an error occurs.

Attributes

BORDER: Shows a thick border around the dialog. Default: "YES". Used only in the creation. Can not be changed after that.
MAXBOX: Requires a maximize button from the window manager. Creation-only attribute.
MINBOX: Requires a minimize button from the window manager. Creation-only attribute.
RESIZE: Allows interactively changing the dialog’s size. Creation-only attribute.
SIZE: Dialog’s size. Differently from other interface elements, the following values can be defined for width and height:
  • "FULL": Defines the dialog’s width (or height) equal to the screen's width (or height)
  • "HALF": Defines the dialog’s width (or height) equal to half the screen's width (or height)
  • "THIRD": Defines the dialog’s width (or height) equal to 1/3 the screen's width (or height)
  • "QUARTER": Defines the dialog’s width (or height) equal to 1/4 of the screen's width (or height)
  • "EIGHTH": Defines the dialog’s width (or height) equal to 1/8 of the screen's width (or height)
Default: the smallest size that allows viewing the dialog.
The dialog’s size has precedence over the smallest size required by its children (either if it was specified in its creation or in run-time). Attributing a NULL value to SIZE or RASTERSIZE (in C) in a dialog will recompute its size according to its children.
TITLE: Dialog’s title.
STARTFOCUS: Name of the dialog element that must receive the focus right after the dialog is opened.
DEFAULTENTER: Name of the button activated when Enter is hit.
DEFAULTESC: Name of the button activated when Esc is hit.
X: Dialog’s horizontal position on the screen, in pixels.
Y: Dialog’s vertical position on the screen, in pixels.
SHRINK: Allows changing the elements’ distribution when the dialog is smaller than the minimum size.
FULLSCREEN
Makes the dialog occupy the whole screen. All dialog details, such as border, maximize button, etc, are removed. Possible values: YES, NO. In Motif you may have to click in the dialog to set its focus.
TOPMOST
This attribute puts the dialog always in front of all other dialogs in all applications. Default: NO.

Callbacks

SHOW_CB: Called right after the dialog is opened, minimized or restored from a minimization.
MAP_CB: Called right after the element is mapped.
CLOSE_CB: Called right before the dialog is closed.

Notes

Except for the menu, all other elements must be inside a dialog to interact with the user. Therefore, an interface element will only be visible when its VISIBLE attribute and that of the dialog are "YES".
A menu that is not associated to a dialog can interact with the user by means of the IupPopup function.
Values attributed to the SIZE attribute of a dialog are always accepted, regardless of the minimum size required by its children. For a dialog to have the minimum necessary size to fit all elements contained in it, simply define NULL (in C) to SIZE. In the case of partial dimensions, a specified dimension is always used, while a non-defined dimension uses the smallest necessary size for the elements in the corresponding direction.

Example

<source lang=lua> --IupDialog Example in IupLua --Creates a simple dialog.

vbox = iup.vbox { iup.label {title="Label"}, iup.button { title="Test" } } dlg = iup.dialog{vbox; title="Dialog"} dlg:show() </source>