class Iup::Dialog
A top-level window, containing a single widget. Supports standard window decorations and a menu.
Example
The following example displays a label widget within the dialog, setting the dialogâs title and size before showing it.
Iup::Dialog.new(label) do |d| d.title = " ... from IUP" d.size = "150x50" end.show
Also see: Menu.
Attributes
RGB color for background of dialog and children.
If set, displays a resize border around dialog.
returns current offset of box in its client as âwidthxheightâ.
returns current size of box as âwidthxheightâ.
Defines the mouse shape / cursor for the dialog.
Identifies button to activate when âenterâ is pressed.
Identifies button to activate when âescapeâ is pressed.
Allows container to fill available space in indicated direction. Values ânoâ / âhorizontalâ / âverticalâ / âyesâ.
ânoâ / âyesâ.
An ImageWidget instance to use for dialog.
ânoâ / âyesâ, to show maximize box on dialog.
ânoâ / âyesâ, to show minimize box on dialog.
Returns modal state of dialog.
This dialog will be always in front of the parent dialog. If the parent is minimized, this dialog is automatically minimized. Important Closing the parent will also close the child, but the child dialogâs CLOSE_CB method will not be called.
ânormalâ / âmaximizedâ / âminimizedâ / âfullâ.
Size of the dialog, in pixels, value as âwidthxheightâ.
ânoâ / âyesâ.
returns position in pixels on screen as âx,yâ.
ânoâ / âyesâ, allows dialogâs children to reduce their size if the dialog is made smaller.
Name of widget to gain focus when dialog first shown.
Tooltip string.
Displayed as dialog title.
Public Class Methods
Source
# File lib/wrapped/dialog.rb, line 29 def initialize widget @handle = IupLib.IupDialog(widget.handle) # run any provided block on instance, to set up further attributes yield self if block_given? end
Creates a new dialog for given widget. If a block is given, the new instance is yielded to it.
-
widget- the child widget to display.
Use show to display the dialog after initialisation; some widgets require the dialog to be mapped first, and then shown after the widget is initialised.
Public Instance Methods
Source
# File lib/wrapped/dialog.rb, line 37 def hide IupLib.IupHide @handle end
Hides the dialog from view.
Source
# File lib/wrapped/dialog.rb, line 42 def map IupLib.IupMap @handle self end
Lays out the child widget and its contents, without showing the dialog.
Source
# File lib/wrapped/dialog.rb, line 50 def popup x=nil, y=nil IupLib.IupPopup @handle, x.to_i, y.to_i end
Shows the dialog at position (x, y).
-
x- x-coordinate to use, or one of show constants -
y- y-coordinate to use, or one of show constants
Source
# File lib/wrapped/dialog.rb, line 58 def show x=nil, y=nil if x.nil? and y.nil? IupLib.IupShow @handle else IupLib.IupShowXY @handle, x.to_i, y.to_i end end
Shows the dialog at the default screen position, or at (x, y) if specified.
-
x- x-coordinate to use, or one of show constants -
y- y-coordinate to use, or one of show constants
Callbacks
Attributes
Sets callback called right before the dialog is closed. Callback must respond to call and take no arguments.
Callback called when the dialog size is changed. Callback must respond to call and takes 2 arguments: (width, height).
-
width-internal width of canvas (client width) -
height- internal height of canvas (client height)
Sets callback called right after the dialog visible state changes, such as from shown to hidden, or maximised to minimised. Callback must respond to call and takes one argument: (state)
-
state- of the change, see state constants