1Gtk2::MessageDialog(3)User Contributed Perl DocumentationGtk2::MessageDialog(3)
2
3
4

NAME

6       Gtk2::MessageDialog
7

SYNOPSIS

9         #
10         # A modal dialog.  Note that the message is a printf-style format.
11         #
12         $dialog = Gtk2::MessageDialog->new ($main_application_window,
13                                             'destroy-with-parent',
14                                             'question', # message type
15                                             'yes-no', # which set of buttons?
16                                             "Pay me $%.2f?", $amount);
17         $response = $dialog->run;
18         if ($response eq 'yes') {
19             send_bill ();
20         }
21         $dialog->destroy;
22
23         #
24         # A non-modal dialog.
25         #
26         $dialog = Gtk2::MessageDialog->new ($main_application_window,
27                                             'destroy-with-parent',
28                                             'question', # message type
29                                             'ok-cancel', # which set of buttons?
30                                             "Self-destruct now?");
31         # react whenever the user responds.
32         $dialog->signal_connect (response => sub {
33                    my ($self, $response) = @_;
34                    if ($response eq 'ok') {
35                            do_the_thing ();
36                    }
37                    $self->destroy;
38         });
39

DESCRIPTION

41       Gtk2::MessageDialog is a dialog with an image representing the type of
42       message (Error, Question, etc.) alongside some message text.  It's sim‐
43       ply a convenience widget; you could construct the equivalent of
44       Gtk2::MessageDialog from Gtk2::Dialog without too much effort, but
45       Gtk2::MessageDialog saves typing and helps create a consistent look and
46       feel for your application.
47
48       The easiest way to do a modal message dialog is to use "$dialog->run",
49       which automatically makes your dialog modal and waits for the user to
50       respond to it.  You can also pass in the GTK_DIALOG_MODAL flag when
51       creating the MessageDialog.
52

HIERARCHY

54         Glib::Object
55         +----Glib::InitiallyUnowned
56              +----Gtk2::Object
57                   +----Gtk2::Widget
58                        +----Gtk2::Container
59                             +----Gtk2::Bin
60                                  +----Gtk2::Window
61                                       +----Gtk2::Dialog
62                                            +----Gtk2::MessageDialog
63

INTERFACES

65         Glib::Object::_Unregistered::AtkImplementorIface
66

METHODS

68       widget = Gtk2::MessageDialog->new ($parent, $flags, $type, $buttons,
69       $format, ...)
70
71           * $parent (Gtk2::Window or undef)
72           * $flags (Gtk2::DialogFlags)
73           * $type (Gtk2::MessageType)
74           * $buttons (Gtk2::ButtonsType)
75           * $format (scalar)
76           * ... (list)
77
78       widget = Gtk2::MessageDialog->new_with_markup ($parent, $flags, $type,
79       $buttons, $message)
80
81           * $parent (Gtk2::Window or undef)
82           * $flags (Gtk2::DialogFlags)
83           * $type (Gtk2::MessageType)
84           * $buttons (Gtk2::ButtonsType)
85           * $message (string or undef) a string containing Pango markup
86
87           Like "new", but allowing Pango markup tags in the message.  Note
88           that this version is not variadic.
89
90       $message_dialog->format_secondary_markup ($message)
91
92           * $message (string or undef)
93
94       $message_dialog->format_secondary_text ($message_format, ...)
95
96           * $message_format (scalar)
97           * ... (list)
98
99       $dialog->set_image ($image)
100
101           * $image (Gtk2::Widget)
102
103       $message_dialog->set_markup ($str)
104
105           * $str (string)
106

PROPERTIES

108       'buttons' (Gtk2::ButtonsType : writable / construct-only / private)
109           The buttons shown in the message dialog
110
111       'image' (Gtk2::Widget : readable / writable / private)
112           The image
113
114       'message-type' (Gtk2::MessageType : readable / writable / construct /
115       private)
116           The type of message
117
118       'secondary-text' (string : readable / writable / private)
119           The secondary text of the message dialog
120
121       'secondary-use-markup' (boolean : readable / writable / private)
122           The secondary text includes Pango markup.
123
124       'text' (string : readable / writable / private)
125           The primary text of the message dialog
126
127       'use-markup' (boolean : readable / writable / private)
128           The primary text of the title includes Pango markup.
129

ENUMS AND FLAGS

131       enum Gtk2::ButtonsType
132
133       * 'none' / 'GTK_BUTTONS_NONE'
134       * 'ok' / 'GTK_BUTTONS_OK'
135       * 'close' / 'GTK_BUTTONS_CLOSE'
136       * 'cancel' / 'GTK_BUTTONS_CANCEL'
137       * 'yes-no' / 'GTK_BUTTONS_YES_NO'
138       * 'ok-cancel' / 'GTK_BUTTONS_OK_CANCEL'
139
140       flags Gtk2::DialogFlags
141
142       * 'modal' / 'GTK_DIALOG_MODAL'
143       * 'destroy-with-parent' / 'GTK_DIALOG_DESTROY_WITH_PARENT'
144       * 'no-separator' / 'GTK_DIALOG_NO_SEPARATOR'
145
146       enum Gtk2::MessageType
147
148       * 'info' / 'GTK_MESSAGE_INFO'
149       * 'warning' / 'GTK_MESSAGE_WARNING'
150       * 'question' / 'GTK_MESSAGE_QUESTION'
151       * 'error' / 'GTK_MESSAGE_ERROR'
152       * 'other' / 'GTK_MESSAGE_OTHER'
153

SEE ALSO

155       Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget,
156       Gtk2::Container, Gtk2::Bin, Gtk2::Window, Gtk2::Dialog
157
159       Copyright (C) 2003-2007 by the gtk2-perl team.
160
161       This software is licensed under the LGPL.  See Gtk2 for a full notice.
162
163
164
165perl v5.8.8                       2007-03-18            Gtk2::MessageDialog(3)
Impressum