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

NAME

6       Gtk2::MessageDialog - wrapper for GtkMessageDialog
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         $dialog->show_all;
40

DESCRIPTION

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

HIERARCHY

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

INTERFACES

66         Glib::Object::_Unregistered::AtkImplementorIface
67         Gtk2::Buildable
68

METHODS

70   widget = Gtk2::MessageDialog->new ($parent, $flags, $type, $buttons,
71       $format, ...)
72       ·   $parent (Gtk2::Window or undef)
73
74       ·   $flags (Gtk2::DialogFlags)
75
76       ·   $type (Gtk2::MessageType)
77
78       ·   $buttons (Gtk2::ButtonsType)
79
80       ·   $format (scalar)
81
82       ·   ... (list)
83
84   widget = Gtk2::MessageDialog->new_with_markup ($parent, $flags, $type,
85       $buttons, $message)
86       ·   $parent (Gtk2::Window or undef)
87
88       ·   $flags (Gtk2::DialogFlags)
89
90       ·   $type (Gtk2::MessageType)
91
92       ·   $buttons (Gtk2::ButtonsType)
93
94       ·   $message (string or undef) a string containing Pango markup
95
96       Like "new", but allowing Pango markup tags in the message.  Note that
97       this version is not variadic.
98
99       Since: gtk+ 2.4
100
101   $message_dialog->format_secondary_markup ($message_format, ...)
102       ·   $message_format (scalar)
103
104       ·   ... (list)
105
106       Since: gtk+ 2.6
107
108   $message_dialog->format_secondary_text ($message_format, ...)
109       ·   $message_format (scalar)
110
111       ·   ... (list)
112
113       Since: gtk+ 2.6
114
115   widget = $dialog->get_image
116       Since: gtk+ 2.14
117
118   $dialog->set_image ($image)
119       ·   $image (Gtk2::Widget)
120
121       Since: gtk+ 2.10
122
123   $message_dialog->set_markup ($str)
124       ·   $str (string)
125
126       Since: gtk+ 2.4
127
128   widget = $message_dialog->get_message_area
129       Since: gtk+ 2.22
130

PROPERTIES

132       'buttons' (Gtk2::ButtonsType : default "none" : writable / construct-
133       only / private / static-nick / static-blurb)
134           The buttons shown in the message dialog
135
136       'image' (Gtk2::Widget : default undef : readable / writable / private /
137       static-nick / static-blurb)
138           The image
139
140       'message-area' (Gtk2::Widget : default undef : readable / private /
141       static-nick / static-blurb)
142           GtkVBox that holds the dialog's primary and secondary labels
143
144       'message-type' (Gtk2::MessageType : default "info" : readable /
145       writable / construct / private / static-nick / static-blurb)
146           The type of message
147
148       'secondary-text' (string : default undef : readable / writable /
149       private / static-nick / static-blurb)
150           The secondary text of the message dialog
151
152       'secondary-use-markup' (boolean : default false : readable / writable /
153       private / static-nick / static-blurb)
154           The secondary text includes Pango markup.
155
156       'text' (string : default "" : readable / writable / private / static-
157       nick / static-blurb)
158           The primary text of the message dialog
159
160       'use-markup' (boolean : default false : readable / writable / private /
161       static-nick / static-blurb)
162           The primary text of the title includes Pango markup.
163

STYLE PROPERTIES

165       'message-border' (integer : default 12 : readable / private / static-
166       nick / static-blurb)
167           Width of border around the label and image in the message dialog
168
169       'use-separator' (boolean : default false : readable / private / static-
170       nick / static-blurb)
171           Whether to put a separator between the message dialog's text and
172           the buttons
173

ENUMS AND FLAGS

175   enum Gtk2::ButtonsType
176       ·   'none' / 'GTK_BUTTONS_NONE'
177
178       ·   'ok' / 'GTK_BUTTONS_OK'
179
180       ·   'close' / 'GTK_BUTTONS_CLOSE'
181
182       ·   'cancel' / 'GTK_BUTTONS_CANCEL'
183
184       ·   'yes-no' / 'GTK_BUTTONS_YES_NO'
185
186       ·   'ok-cancel' / 'GTK_BUTTONS_OK_CANCEL'
187
188   flags Gtk2::DialogFlags
189       ·   'modal' / 'GTK_DIALOG_MODAL'
190
191       ·   'destroy-with-parent' / 'GTK_DIALOG_DESTROY_WITH_PARENT'
192
193       ·   'no-separator' / 'GTK_DIALOG_NO_SEPARATOR'
194
195   enum Gtk2::MessageType
196       ·   'info' / 'GTK_MESSAGE_INFO'
197
198       ·   'warning' / 'GTK_MESSAGE_WARNING'
199
200       ·   'question' / 'GTK_MESSAGE_QUESTION'
201
202       ·   'error' / 'GTK_MESSAGE_ERROR'
203
204       ·   'other' / 'GTK_MESSAGE_OTHER'
205

SEE ALSO

207       Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget,
208       Gtk2::Container, Gtk2::Bin, Gtk2::Window, Gtk2::Dialog
209
211       Copyright (C) 2003-2011 by the gtk2-perl team.
212
213       This software is licensed under the LGPL.  See Gtk2 for a full notice.
214
215
216
217perl v5.32.0                      2020-07-28            Gtk2::MessageDialog(3)
Impressum