Class: Iup::MessageDialog

Inherits:
Widget
  • Object
show all
Defined in:
lib/wrapped/messagedialog.rb

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.buttons = 'yesnocancel' 
  d.buttondefault = 2
end
md.popup 
puts "Clicked button is: #{md.buttonresponse}"

Note that popup must be used to show the dialog.

Also see: Iup.message

Instance Attribute Summary

Attributes inherited from Widget

#handle

Instance Method Summary collapse

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

#define_callback

Constructor Details

#initialize {|_self| ... } ⇒ MessageDialog

Creates a new dialog. If a block is given, the new instance is yielded to it.

Yields:

  • (_self)

Yield Parameters:



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

#buttondefaultObject

:attr: buttondefault Index of default button, ‘1’ / ‘2’ / ‘3’.



81
# File 'lib/wrapped/messagedialog.rb', line 81

define_attribute :buttondefault

#buttonresponseObject

:attr: buttonresponse Index of the pressed button, ‘1’ / ‘2’ / ‘3’.



86
# File 'lib/wrapped/messagedialog.rb', line 86

define_attribute :buttonresponse

#buttonsObject

: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

#dialogtypeObject

: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

Shows the dialog at position x, y.



72
73
74
# File 'lib/wrapped/messagedialog.rb', line 72

def popup x=0, y=0
  IupLib.IupPopup @handle, x, y
end

#titleObject

:attr: title Title text for the message dialog.



119
# File 'lib/wrapped/messagedialog.rb', line 119

define_attribute :title

#valueObject

:attr: value Message text to display within the dialog.



124
# File 'lib/wrapped/messagedialog.rb', line 124

define_attribute :value