Basics
Guides
API Reference
Basics
Guides
API Reference
[38:7] extends: object
GtkMessageDialog presents a dialog with some message text.
GtkMessageDialog from GtkDialog without too much effort, but
GtkMessageDialog saves typing. The easiest way to do a modal message dialog
is to use the %GTK_DIALOG_MODAL flag, which will call
[method@Gtk.Window.set_modal] internally. The dialog will prevent interaction
with the parent window until it's hidden or destroyed. You can use the
[signal@Gtk.Dialog::response] signal to know when the user dismissed the
dialog. An example for using a modal dialog: c GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL; dialog = gtk_message_dialog_new (parent_window, flags, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error reading “%s”: %s", filename, g_strerror (errno)); // Destroy the dialog when the user responds to it // (e.g. clicks a button) g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL); You might do a non-modal GtkMessageDialog simply by omitting the
%GTK_DIALOG_MODAL flag: c GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; dialog = gtk_message_dialog_new (parent_window, flags, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error reading “%s”: %s", filename, g_strerror (errno)); // Destroy the dialog when the user responds to it // (e.g. clicks a button) g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL); # GtkMessageDialog as
GtkBuildable The GtkMessageDialog implementation of the GtkBuildable
interface exposes the message area as an internal child with the name
“message_area”.
MessageDialog (Handle = null)
Creates a new
MessageDialogby wrapping a native handle or another wrapper.
Handle is the native handle or another wrapper whose handle to adopt.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asDialog ()
Wraps this handle as
Dialog.
A Dialog object.asAccessible ()
Wraps this handle as
Accessible.
A Accessible object.asBuildable ()
Wraps this handle as
Buildable.
A Buildable object.asConstraintTarget ()
Wraps this handle as
ConstraintTarget.
A ConstraintTarget object.asNative ()
Wraps this handle as
Native.
A Native object.asRoot ()
Wraps this handle as
Root.
A Root object.asShortcutManager ()
Wraps this handle as
ShortcutManager.
A ShortcutManager object.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setMessagetype (string Value)
The type of the message.
Value is the new property value.None.setSecondarytext (string Value)
The secondary text of the message dialog.
Value is the new property value.None.setSecondaryusemarkup (bool Value)
%TRUE if the secondary text of the dialog includes Pango markup. See [func@Pango.parse_markup].
Value is the new property value.None.setText (string Value)
The primary text of the message dialog. If the dialog has a secondary text, this will appear as the title.
Value is the new property value.None.setUsemarkup (bool Value)
%TRUE if the primary text of the dialog includes Pango markup. See [func@Pango.parse_markup].
Value is the new property value.None.get_message_area ()
Returns the message area of the dialog. This is the box where the dialog’s primary and secondary labels are packed. You can add your own extra content to that box and it will appear below those labels. See [method@Gtk.Dialog.get_content_area] for the corresponding function in the parent [class@Gtk.Dialog].
set_markup (string str)
Sets the text of the message dialog.
str is string with Pango markup.None.[283:14] static extends: object
Generated metadata helpers for MessageDialog class surfaces.
properties ()
Returns property metadata for
MessageDialog.
A list.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.