Basics
Guides
API Reference
Basics
Guides
API Reference
[349:14] static extends: object
Alternate constructors for GtkMessageDialog. Usage:
GtkMessageDialogCtors.<name>(...). The primary constructor lives
directly on GtkMessageDialog.
newWithMarkup (object parent, string flags, string type, string buttons, string message_format, list varargs)
Creates a new message dialog. This is a simple dialog with some text that is marked up with Pango markup. When the user clicks a button a “response” signal is emitted with response IDs from [enum@Gtk.ResponseType]. See [class@Gtk.Dialog] for more details. Special XML characters in the printf() arguments passed to this function will automatically be escaped as necessary. (See g_markup_printf_escaped() for how this is implemented.) Usually this is what you want, but if you have an existing Pango markup string that you want to use literally as the label, then you need to use [method@Gtk.MessageDialog.set_markup] instead, since you can’t pass the markup string either as the format (it might contain “%” characters) or as a string argument.
c GtkWidget *dialog; GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; dialog = gtk_message_dialog_new (parent_window, flags, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, NULL); gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), markup);
parent is transient parent.flags is flags.type is type of message.buttons is set of buttons to use.message_format is printf()-style format string.... is arguments for @message_format.A new GtkMessageDialog.[39: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”.
GtkMessageDialog (parent = null, flags = null, type = null, buttons = null, message_format = null, ___ = null)
Creates a new message dialog. This is a simple dialog with some text the user may want to see. When the user clicks a button a “response” signal is emitted with response IDs from [enum@Gtk.ResponseType]. See [class@Gtk.Dialog] for more details.
parent is transient parent.flags is flags.type is type of message.buttons is set of buttons to use.message_format is printf()-style format string.___ is arguments for @message_format.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
GtkDialog.
A GtkDialog object.asAccessible ()
Wraps this handle as
GtkAccessible.
A GtkAccessible object.asBuildable ()
Wraps this handle as
GtkBuildable.
A GtkBuildable object.asConstraintTarget ()
Wraps this handle as
GtkConstraintTarget.
A GtkConstraintTarget object.asNative ()
Wraps this handle as
GtkNative.
A GtkNative object.asRoot ()
Wraps this handle as
GtkRoot.
A GtkRoot object.asShortcutManager ()
Wraps this handle as
GtkShortcutManager.
A GtkShortcutManager 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.format_secondary_markup (string message_format, list varargs)
Sets the secondary text of the message dialog. The @message_format is assumed to contain Pango markup. Due to an oversight, this function does not escape special XML characters like [ctor@Gtk.MessageDialog.new_with_markup] does. Thus, if the arguments may contain special XML characters, you should use g_markup_printf_escaped() to escape it.
c char *msg; msg = g_markup_printf_escaped (message_format, ...); gtk_message_dialog_format_secondary_markup (message_dialog, "%s", msg); g_free (msg);
message_format is printf()-style string with Pango markup.... is arguments for @message_format.None.format_secondary_text (string message_format, list varargs)
Sets the secondary text of the message dialog.
message_format is printf()-style format string.... is arguments for @message_format.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].
A GtkBox corresponding to the “message area” in the @message_dialog.set_markup (string str)
Sets the text of the message dialog.
str is string with Pango markup.None.[390: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.