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         $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
97           that this version is not variadic.
98
99           Since: gtk+ 2.4
100
101   $message_dialog->format_secondary_markup ($message)
102           ·   $message (string or undef)
103
104           Since: gtk+ 2.6
105
106   $message_dialog->format_secondary_text ($message_format, ...)
107           ·   $message_format (scalar)
108
109           ·   ... (list)
110
111           Since: gtk+ 2.6
112
113   widget = $dialog->get_image
114           Since: gtk+ 2.14
115
116   $dialog->set_image ($image)
117           ·   $image (Gtk2::Widget)
118
119           Since: gtk+ 2.10
120
121   $message_dialog->set_markup ($str)
122           ·   $str (string)
123
124           Since: gtk+ 2.4
125

PROPERTIES

127       'buttons' (Gtk2::ButtonsType : writable / construct-only / private)
128           The buttons shown in the message dialog
129
130       'image' (Gtk2::Widget : readable / writable / private)
131           The image
132
133       'message-type' (Gtk2::MessageType : readable / writable / construct /
134       private)
135           The type of message
136
137       'secondary-text' (string : readable / writable / private)
138           The secondary text of the message dialog
139
140       'secondary-use-markup' (boolean : readable / writable / private)
141           The secondary text includes Pango markup.
142
143       'text' (string : readable / writable / private)
144           The primary text of the message dialog
145
146       'use-markup' (boolean : readable / writable / private)
147           The primary text of the title includes Pango markup.
148

ENUMS AND FLAGS

150   enum Gtk2::ButtonsType
151       ·   'none' / 'GTK_BUTTONS_NONE'
152
153       ·   'ok' / 'GTK_BUTTONS_OK'
154
155       ·   'close' / 'GTK_BUTTONS_CLOSE'
156
157       ·   'cancel' / 'GTK_BUTTONS_CANCEL'
158
159       ·   'yes-no' / 'GTK_BUTTONS_YES_NO'
160
161       ·   'ok-cancel' / 'GTK_BUTTONS_OK_CANCEL'
162
163   flags Gtk2::DialogFlags
164       ·   'modal' / 'GTK_DIALOG_MODAL'
165
166       ·   'destroy-with-parent' / 'GTK_DIALOG_DESTROY_WITH_PARENT'
167
168       ·   'no-separator' / 'GTK_DIALOG_NO_SEPARATOR'
169
170   enum Gtk2::MessageType
171       ·   'info' / 'GTK_MESSAGE_INFO'
172
173       ·   'warning' / 'GTK_MESSAGE_WARNING'
174
175       ·   'question' / 'GTK_MESSAGE_QUESTION'
176
177       ·   'error' / 'GTK_MESSAGE_ERROR'
178
179       ·   'other' / 'GTK_MESSAGE_OTHER'
180

SEE ALSO

182       Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget,
183       Gtk2::Container, Gtk2::Bin, Gtk2::Window, Gtk2::Dialog
184
186       Copyright (C) 2003-2008 by the gtk2-perl team.
187
188       This software is licensed under the LGPL.  See Gtk2 for a full notice.
189
190
191
192perl v5.12.0                      2010-05-02            Gtk2::MessageDialog(3)
Impressum