Gtk::MessageDialog
class Gtk::MessageDialog
Gtk::MessageDialog presents a dialog with an image representing the type of message (Error, Question, etc.) alongside some message text. It's simply a convenience widget; you could construct the equivalent of Gtk::MessageDialog from Gtk::Dialog without too much effort, but Gtk::MessageDialog saves typing.
The easiest way to do a modal message dialog is to use Gtk::Dialog#run, though you can also pass in the Gtk::Dialog::MODAL flag, Gtk::Dialog#run automatically makes the dialog modal and waits for the user to respond to it. Gtk::Dialog#run returns when any dialog button is clicked.
Exampl2 2. A modal dialog
dialog = Gtk::MessageDialog.new(main_app_window,
Gtk::Dialog::DESTROY_WITH_PARENT,
Gtk::MessageDialog::QUESTION,
Gtk::MessageDialog::BUTTONS_CLOSE,
"Error loading file '%s'" % filename)
dialog.run
dialog.destroy
Class Methods
Gtk::MessageDialog.new(parent, flags, type, buttons, message = nil)-
Creates a new message dialog, which is a simple dialog with an icon indicating the dialog type (error, warning, etc.) and some text the user may want to see. When the user clicks a button a "response" signal is emitted with response IDs from Gtk::Dialog#ResponseType. See Gtk::Dialog for more details.
- parent: transient parent(Gtk::Window), or nil for none.
- flags: Gtk::Dialog#Flags.
- type: Gtk::MessageDialog#Type.
- buttons: Gtk::MessageDialog#ButtonsType.
- message: message.
- Returns: a new Gtk::MessageDialog
Instance Methods
buttons=(button_type)-
Set Gtk::MessageDialog#ButtonsType.
- button_type: Gtk::MessageDialog#ButtonsType.
- Returns: button_type.
set_buttons(button_type)-
Same as Gtk::MessageDialog#buttons=.
- button_type: Gtk::MessageDialog#ButtonsType.
- Returns: self.
message_type- Get Gtk::MessageDialog#Type.
message_type=(message_type)-
Set Gtk::MessageDialog#Type.
- message_type: Gtk::MessageDialog#Type.
- Returns: Gtk::MessageDialog#Type.
set_message_type(message_type)-
Same as Gtk::MessageDialog#message_type=.
- message_type: Gtk::MessageDialog#Type.
- Returns: self.
markup=(markup)-
Sets the text of the message dialog to be str, which is marked up with the Pango text markup language. Since 2.4
- markup: markup string (see Pango text markup language)
- Returns: markup
set_markup(markup)-
Same as Gtk::MessageDialog#markup=. Since 2.4
- markup: markup string (see Pango text markup language)
- Returns: self
secondary_text=(text)-
Sets the secondary text of the message dialog.
Note that setting a secondary text makes the primary text become bold, unless you have provided explicit markup. Since 2.6
- text: a String, or nil
- Returns: text
set_secondary_text(text)-
Same as Gtk::MessageDialog#secondary_text=. Since 2.6
- text: a String, or nil
- Returns: self
secondary_markup=(markup)-
Sets the secondary text of the message dialog which is marked up with the Pango text markup language.
Note that setting a secondary text makes the primary text become bold, unless you have provided explicit markup. Since 2.6
- markup: markup string (see Pango text markup language) or nil
- Returns: markup
set_secondary_markup(markup)-
Same as Gtk::MessageDialog#secondary_markup=. Since 2.6
- markup: markup string (see Pango text markup language) or nil
- Returns: self
image-
Gets the dialog's image. Since 2.10
- Returns: The image (Gtk::Widget)
image=(image)-
Sets the dialog's image. Since 2.10
- image: The image (Gtk::Widget)
- Returns: image
set_image(image)-
Same as image=. Since 2.10
- image: The dialog's image (Gtk::Widget)
- Returns: self
ref_accessible- See Atk::Implementor#ref_accessible.
secondary_text-
Gets the secondary text of the message dialog.
- Returns: The secondary text of the message dialog
secondary_use_markup=(secondary_use_markup)-
Sets the secondary text includes Pango:: markup..
- secondary_use_markup: The secondary text includes Pango:: markup.
- Returns: secondary_use_markup
secondary_use_markup?-
Gets the secondary text includes Pango:: markup..
- Returns: The secondary text includes Pango:: markup.
set_secondary_use_markup(secondary_use_markup)-
Same as secondary_use_markup=.
- secondary_use_markup: The secondary text includes Pango:: markup.
- Returns: self
set_text(text)-
Same as text=.
- text: The primary text of the message dialog
- Returns: self
set_use_markup(use_markup)-
Same as use_markup=.
- use_markup: The primary text of the title includes Pango:: markup.
- Returns: self
text-
Gets the primary text of the message dialog.
- Returns: The primary text of the message dialog
text=(text)-
Sets the primary text of the message dialog.
- text: The primary text of the message dialog
- Returns: text
use_markup=(use_markup)-
Sets the primary text of the title includes Pango:: markup..
- use_markup: The primary text of the title includes Pango:: markup.
- Returns: use_markup
use_markup?-
Gets the primary text of the title includes Pango:: markup..
- Returns: The primary text of the title includes Pango:: markup.
add_child- See Gtk::Buildable#add_child.
construct_child- See Gtk::Buildable#construct_child.
get_internal_child- See Gtk::Buildable#get_internal_child.
name- See Gtk::Buildable#name.
name=- See Gtk::Buildable#name=.
set_buildable_property- See Gtk::Buildable#set_buildable_property.
set_name- See Gtk::Buildable#set_name.
Constants
ButtonsType
Prebuilt sets of buttons for the dialog. If none of these choices are appropriate, simply use Gtk::MessageDialog::BUTTONS_NONE then call Gtk::Dialog#add_buttons method.
BUTTONS_CANCEL- a Cancel button.
BUTTONS_CLOSE- a Close button.
BUTTONS_NONE- no buttons at all.
BUTTONS_OK- an OK button.
BUTTONS_OK_CANCEL- OK and Cancel buttons.
BUTTONS_YES_NO- Yes and No buttons.
Type
The type of message being displayed in the dialog.
Properties
buttons: Gtk::MessageDialog::ButtonsType (Write)-
The buttons shown in the message dialog
- Default value: Gtk::MessageDialog::BUTTONS_NONE
image: Gtk::Widget (Read/Write)- The image Since 2.10
message-type: Gtk::MessageDialog::Type (Read/Write)-
The type of message
- Default value: Gtk::MessageDialog::INFO
secondary-text: String (Read/Write)-
The secondary text of the message dialog Since 2.10
- Default value: nil
secondary-use-markup: true or false (Read/Write)-
true if the secondary text of the dialog includes Pango markup. See Pango.parse_markup. Since 2.10
- Default value: false
text: String (Read/Write)-
The primary text of the message dialog. If the dialog has a secondary text, this will appear as the title. Since 2.10
- Default value: nil
use-markup: true or false (Read/Write)-
true if the primary text of the dialog includes Pango markup. See Pango.parse_markup. Since 2.10
- Default value: false
Style Properties
message-border: Integer (Read)-
Width of border around the label and image in the message dialog
- Allowed values: >= 0
- Default value: 12
use-separator: true or false (Read)-
Whether to put a separator between the message dialog's text and the buttons Since 2.4
- Default value: false
Keyword(s):
References:[Message Dialogues] [Ruby/GTK2 API Index] [Dialog Widgets] [Ruby/GTK Object Hierarchy] [News_20050306_1] [Gtk::MessageDialog] [Creating Your Own Dialogs] [Ruby/GTK] [Ruby/GTK classes/modules index and documented status] [Gtk::MessageDialog::Type] [Gtk::MessageDialog::ButtonsType] [Gtk::Dialog]