![](gtk-logo.svg)

###  [ Gtk ](index.html)

API Version: 3.0

Library Version: 3.24

#####  Type

[ MessageDialog ](class.MessageDialog.html)

#####  Constructors

[ new ](ctor.MessageDialog.new.html) [ new_with_markup
](ctor.MessageDialog.new_with_markup.html)

Generated by [ gi-docgen ](https://gitlab.gnome.org/GNOME/gi-docgen) 2023.4

###  Constructor

#  [ Gtk ](index.html) [ MessageDialog ](class.MessageDialog.html)
new_with_markup

since: 2.4

####  Declaration  [ [src]
](https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkmessagedialog.h#L107
"go to source location")

    
    
    GtkWidget*
    gtk_message_dialog_new_with_markup (
      GtkWindow* parent,
      GtkDialogFlags flags,
      GtkMessageType type,
      GtkButtonsType buttons,
      const gchar* message_format,
      ...
    )
    

`

####  Description  [ [src]
](https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkmessagedialog.c#L645
"go to source location")

Creates a new message dialog, which is a simple dialog with some text that is
marked up with the [Pango text markup language][PangoMarkupFormat]. When the
user clicks a button a “response” signal is emitted with response IDs from `
GtkResponseType ` . See ` GtkDialog ` 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 ` gtk_message_dialog_set_markup() ` instead, since you
can’t pass the markup string either as the format (it might contain “%”
characters) or as a string argument.

    
    
     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);
    

Available since: 2.4

This method is not directly available to language bindings.

####  Parameters

` parent `

    

_Type:_ [ ` GtkWindow ` ](class.Window.html)

Transient parent, or ` NULL ` for none.

The argument can be ` NULL ` .  
---  
The data is owned by the caller of the function.  
` flags `

    

_Type:_ [ ` GtkDialogFlags ` ](flags.DialogFlags.html)

Flags.

` type `

    

_Type:_ [ ` GtkMessageType ` ](enum.MessageType.html)

Type of message.

` buttons `

    

_Type:_ [ ` GtkButtonsType ` ](enum.ButtonsType.html)

Set of buttons to use.

` message_format `

    

_Type:_ ` const gchar* `

Printf()-style format string, or ` NULL ` .

The argument can be ` NULL ` .  
---  
The data is owned by the caller of the function.  
The value is a NUL terminated UTF-8 string.  
` ... `

    

_Type:_ ` `

Arguments for ` message_format ` .

####  Return value

_Type:_ [ ` GtkWidget ` ](class.Widget.html)

A new ` GtkMessageDialog ` .

The data is owned by the called function.  
---