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)
134           The buttons shown in the message dialog
135
136       'image' (Gtk2::Widget : default undef : readable / writable / private)
137           The image
138
139       'message-area' (Gtk2::Widget : default undef : readable / private)
140           GtkVBox that holds the dialog's primary and secondary labels
141
142       'message-type' (Gtk2::MessageType : default "info" : readable /
143       writable / construct / private)
144           The type of message
145
146       'secondary-text' (string : default undef : readable / writable /
147       private)
148           The secondary text of the message dialog
149
150       'secondary-use-markup' (boolean : default false : readable / writable /
151       private)
152           The secondary text includes Pango markup.
153
154       'text' (string : default "" : readable / writable / private)
155           The primary text of the message dialog
156
157       'use-markup' (boolean : default false : readable / writable / private)
158           The primary text of the title includes Pango markup.
159

STYLE PROPERTIES

161       'message-border' (integer : default 12 : readable / private)
162           Width of border around the label and image in the message dialog
163
164       'use-separator' (boolean : default false : readable / private)
165           Whether to put a separator between the message dialog's text and
166           the buttons
167

ENUMS AND FLAGS

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

SEE ALSO

201       Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget,
202       Gtk2::Container, Gtk2::Bin, Gtk2::Window, Gtk2::Dialog
203
205       Copyright (C) 2003-2011 by the gtk2-perl team.
206
207       This software is licensed under the LGPL.  See Gtk2 for a full notice.
208
209
210
211perl v5.30.0                      2019-07-26            Gtk2::MessageDialog(3)
Impressum