Crea  Modifica  FrontPage  Indici  Cerca  Ultime modifiche  History  RSS  Login

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.

Instance Methods

buttons=(button_type)
Set Gtk::MessageDialog#ButtonsType.
set_buttons(button_type)
Same as Gtk::MessageDialog#buttons=.
message_type
Get Gtk::MessageDialog#Type.
message_type=(message_type)
Set Gtk::MessageDialog#Type.
set_message_type(message_type)
Same as Gtk::MessageDialog#message_type=.
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
image=(image)
Sets the dialog's image. Since 2.10
set_image(image)
Same as image=. Since 2.10
  • image: The dialog's image (Gtk::Widget)
  • Returns: self

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.

ERROR
Fatal error message.
INFO
Informational message.
QUESTION
Question requiring a choice.
WARNING
Nonfatal warning message.

Properties

buttons: Gtk::MessageDialog::ButtonsType (Write)
The buttons shown in the message dialog
image: Gtk::Widget (Read/Write)
The image Since 2.10
message-type: Gtk::MessageDialog::Type (Read/Write)
The type of message
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

ChangeLog

  • 2007-02-13 Apply 2.10 - Masao
  • 2005-03-29 Added methods of 2.6 - Masao
  • 2004-05-25 Added methods of 2.4 - Masao
  • 2003-04-03 Initial upload - Masao
Ultima modifica:2007/06/23 03:34:45
Parola chiave:
Referenze:[Gtk::Dialog] [Gtk::MessageDialog]