Gtk2::MessageDialog(3)User Contributed Perl DocumentatioGtk2::MessageDialog(3)NAMEGtk2::MessageDialogSYNOPSIS
#
# A modal dialog. Note that the message is a printf-style format.
#
$dialog = Gtk2::MessageDialog->new ($main_application_window,
'destroy-with-parent',
'question', # message type
'yes-no', # which set of buttons?
"Pay me $%.2f?", $amount);
$response = $dialog->run;
if ($response eq 'yes') {
send_bill ();
}
$dialog->destroy;
#
# A non-modal dialog.
#
$dialog = Gtk2::MessageDialog->new ($main_application_window,
'destroy-with-parent',
'question', # message type
'ok-cancel', # which set of buttons?
"Self-destruct now?");
# react whenever the user responds.
$dialog->signal_connect (response => sub {
my ($self, $response) = @_;
if ($response eq 'ok') {
do_the_thing ();
}
$self->destroy;
});
DESCRIPTIONGtk2::MessageDialog is 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
Gtk2::MessageDialog from Gtk2::Dialog without too much effort, but
Gtk2::MessageDialog saves typing and helps create a consistent look and
feel for your application.
The easiest way to do a modal message dialog is to use "$dialog->run",
which automatically makes your dialog modal and waits for the user to
respond to it. You can also pass in the GTK_DIALOG_MODAL flag when
creating the MessageDialog.
HIERARCHY
Glib::Object
+----Glib::InitiallyUnowned
+----Gtk2::Object
+----Gtk2::Widget
+----Gtk2::Container
+----Gtk2::Bin
+----Gtk2::Window
+----Gtk2::Dialog
+----Gtk2::MessageDialog
INTERFACES
Glib::Object::_Unregistered::AtkImplementorIface
METHODS
widget = Gtk2::MessageDialog->new ($parent, $flags, $type, $buttons,
$format, ...)
· $parent (Gtk2::Window or undef)
· $flags (Gtk2::DialogFlags)
· $type (Gtk2::MessageType)
· $buttons (Gtk2::ButtonsType)
· $format (scalar)
· ... (list)
widget = Gtk2::MessageDialog->new_with_markup ($parent, $flags, $type,
$buttons, $message)
· $parent (Gtk2::Window or undef)
· $flags (Gtk2::DialogFlags)
· $type (Gtk2::MessageType)
· $buttons (Gtk2::ButtonsType)
· $message (string or undef) a string containing Pango markup
Like "new", but allowing Pango markup tags in the message. Note
that this version is not variadic.
$message_dialog->format_secondary_markup ($message)
· $message (string or undef)
$message_dialog->format_secondary_text ($message_format, ...)
· $message_format (scalar)
· ... (list)
$dialog->set_image ($image)
· $image (Gtk2::Widget)
$message_dialog->set_markup ($str)
· $str (string)
PROPERTIES
'buttons' (Gtk2::ButtonsType : writable / construct-only / private)
The buttons shown in the message dialogue
'image' (Gtk2::Widget : readable / writable / private)
The image
'message-type' (Gtk2::MessageType : readable / writable / construct /
private)
The type of message
'secondary-text' (string : readable / writable / private)
The secondary text of the message dialogue
'secondary-use-markup' (boolean : readable / writable / private)
The secondary text includes Pango markup.
'text' (string : readable / writable / private)
The primary text of the message dialogue
'use-markup' (boolean : readable / writable / private)
The primary text of the title includes Pango markup.
ENUMS AND FLAGS
enum Gtk2::ButtonsType
· 'none' / 'GTK_BUTTONS_NONE'
· 'ok' / 'GTK_BUTTONS_OK'
· 'close' / 'GTK_BUTTONS_CLOSE'
· 'cancel' / 'GTK_BUTTONS_CANCEL'
· 'yes-no' / 'GTK_BUTTONS_YES_NO'
· 'ok-cancel' / 'GTK_BUTTONS_OK_CANCEL'
flags Gtk2::DialogFlags
· 'modal' / 'GTK_DIALOG_MODAL'
· 'destroy-with-parent' / 'GTK_DIALOG_DESTROY_WITH_PARENT'
· 'no-separator' / 'GTK_DIALOG_NO_SEPARATOR'
enum Gtk2::MessageType
· 'info' / 'GTK_MESSAGE_INFO'
· 'warning' / 'GTK_MESSAGE_WARNING'
· 'question' / 'GTK_MESSAGE_QUESTION'
· 'error' / 'GTK_MESSAGE_ERROR'
· 'other' / 'GTK_MESSAGE_OTHER'
SEE ALSO
Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget,
Gtk2::Container, Gtk2::Bin, Gtk2::Window, Gtk2::Dialog
COPYRIGHT
Copyright (C) 2003-2006 by the gtk2-perl team.
This software is licensed under the LGPL. See Gtk2 for a full notice.
perl v5.10.0 2008-08-29 Gtk2::MessageDialog(3)