Class: Iup::MessageDialog
Overview
A predefined modal dialog used to display a message and requesting one of a constrained choice of responses.
Example
The following example shows off many of the features, setting up a question-type dialog with three buttons and a default response of “no”:
md = Iup::MessageDialog.new do |d|
d.title = "Example MessageDialog"
d.dialogtype = 'question'
d.value = "Should we do this?"
d. = 'yesnocancel'
d. = 2
end
md.popup
puts "Clicked button is: #{md.}"
Note that popup must be used to show the dialog.
Also see: Iup.message
Instance Attribute Summary
Attributes inherited from Widget
Instance Method Summary collapse
-
#buttondefault ⇒ Object
:attr: buttondefault Index of default button, ‘1’ / ‘2’ / ‘3’.
-
#buttonresponse ⇒ Object
:attr: buttonresponse Index of the pressed button, ‘1’ / ‘2’ / ‘3’.
-
#buttons ⇒ Object
:attr: buttons Choice of buttons to display: ‘OK’ / ‘OKCANCEL’ / ‘RETRYCANCEL’ / ‘YESNO’ / ‘YESNOCANCEL’.
-
#dialogtype ⇒ Object
:attr: dialogtype Selects the icon to display: ‘error’ / ‘information’ / ‘message’ / ‘question’ / ‘warning’.
-
#initialize {|_self| ... } ⇒ MessageDialog
constructor
Creates a new dialog.
-
#parentdialog(parent) ⇒ Object
:nodoc:.
-
#popup(x = 0, y = 0) ⇒ Object
Shows the dialog at position x, y.
-
#title ⇒ Object
:attr: title Title text for the message dialog.
-
#value ⇒ Object
:attr: value Message text to display within the dialog.
Methods inherited from Widget
#active, #assign_handle, #bgcolor, #destroy, #enterwindow_cb=, #fgcolor, #font, #getfocus_cb=, #help_cb=, #k_any=, #killfocus_cb=, #leavewindow_cb=, #map_cb=, #maxsize, #minsize, #open_controls, #size, #unmap_cb=, #visible, #wid, #zorder
Methods included from AttributeBuilders
#define_attribute, #define_id_attribute, #define_id_reader, #define_id_writer, #define_property_attribute, #define_property_reader, #define_property_writer, #define_reader, #define_writer
Methods included from CallbackSetter
Constructor Details
#initialize {|_self| ... } ⇒ MessageDialog
Creates a new dialog. If a block is given, the new instance is yielded to it.
63 64 65 66 67 |
# File 'lib/wrapped/messagedialog.rb', line 63 def initialize @handle = IupLib.IupMessageDlg yield self if block_given? end |
Instance Method Details
#buttondefault ⇒ Object
:attr: buttondefault Index of default button, ‘1’ / ‘2’ / ‘3’.
81 |
# File 'lib/wrapped/messagedialog.rb', line 81 define_attribute :buttondefault |
#buttonresponse ⇒ Object
:attr: buttonresponse Index of the pressed button, ‘1’ / ‘2’ / ‘3’.
86 |
# File 'lib/wrapped/messagedialog.rb', line 86 define_attribute :buttonresponse |
#buttons ⇒ Object
:attr: buttons Choice of buttons to display: ‘OK’ / ‘OKCANCEL’ / ‘RETRYCANCEL’ / ‘YESNO’ / ‘YESNOCANCEL’. If help_cb is defined, then a ‘help’ button is also displayed.
92 |
# File 'lib/wrapped/messagedialog.rb', line 92 define_attribute :buttons |
#dialogtype ⇒ Object
:attr: dialogtype Selects the icon to display: ‘error’ / ‘information’ / ‘message’ / ‘question’ / ‘warning’.
98 |
# File 'lib/wrapped/messagedialog.rb', line 98 define_attribute :dialogtype |
#parentdialog(parent) ⇒ Object
:nodoc:
108 109 110 |
# File 'lib/wrapped/messagedialog.rb', line 108 def parentdialog attribute_reference('PARENTDIALOG', Dialog, nil) end |
#popup(x = 0, y = 0) ⇒ Object
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
72 73 74 |
# File 'lib/wrapped/messagedialog.rb', line 72 def popup x=0, y=0 IupLib.IupPopup @handle, x, y end |
#title ⇒ Object
:attr: title Title text for the message dialog.
119 |
# File 'lib/wrapped/messagedialog.rb', line 119 define_attribute :title |
#value ⇒ Object
:attr: value Message text to display within the dialog.
124 |
# File 'lib/wrapped/messagedialog.rb', line 124 define_attribute :value |