|
NAMEGtk2::MessageDialog - wrapper for GtkMessageDialog SYNOPSIS #
# 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;
});
$dialog->show_all;
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
INTERFACESGlib::Object::_Unregistered::AtkImplementorIface Gtk2::Buildable METHODSwidget = Gtk2::MessageDialog->new ($parent, $flags, $type, $buttons, $format, ...)
widget = Gtk2::MessageDialog->new_with_markup ($parent, $flags, $type, $buttons, $message)
Like "new", but allowing Pango markup tags in the message. Note that this version is not variadic. Since: gtk+ 2.4 $message_dialog->format_secondary_markup ($message_format, ...)
Since: gtk+ 2.6 $message_dialog->format_secondary_text ($message_format, ...)
Since: gtk+ 2.6 widget = $dialog->get_imageSince: gtk+ 2.14 $dialog->set_image ($image)
Since: gtk+ 2.10 $message_dialog->set_markup ($str)
Since: gtk+ 2.4 widget = $message_dialog->get_message_areaSince: gtk+ 2.22 PROPERTIES
STYLE PROPERTIES
ENUMS AND FLAGSenum Gtk2::ButtonsType
flags Gtk2::DialogFlags
enum Gtk2::MessageType
SEE ALSOGtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Bin, Gtk2::Window, Gtk2::Dialog COPYRIGHTCopyright (C) 2003-2011 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice.
|