![](gtk-logo.svg)

###  [ Gtk ](index.html)

API Version: 3.0

Library Version: 3.24

#####  Type

[ Dialog ](class.Dialog.html#description)

#####  Constructors

[ new ](ctor.Dialog.new.html) [ new_with_buttons
](ctor.Dialog.new_with_buttons.html)

#####  Instance methods

[ add_action_widget ](method.Dialog.add_action_widget.html) [ add_button
](method.Dialog.add_button.html) [ add_buttons
](method.Dialog.add_buttons.html) [ get_action_area
](method.Dialog.get_action_area.html) [ get_content_area
](method.Dialog.get_content_area.html) [ get_header_bar
](method.Dialog.get_header_bar.html) [ get_response_for_widget
](method.Dialog.get_response_for_widget.html) [ get_widget_for_response
](method.Dialog.get_widget_for_response.html) [ response
](method.Dialog.response.html) [ run ](method.Dialog.run.html) [
set_alternative_button_order
](method.Dialog.set_alternative_button_order.html) [
set_alternative_button_order_from_array
](method.Dialog.set_alternative_button_order_from_array.html) [
set_default_response ](method.Dialog.set_default_response.html) [
set_response_sensitive ](method.Dialog.set_response_sensitive.html)

#####  Properties

[ use-header-bar ](property.Dialog.use-header-bar.html)

#####  Signals

[ close ](signal.Dialog.close.html) [ response ](signal.Dialog.response.html)

#####  Virtual methods

[ close ](vfunc.Dialog.close.html) [ response ](vfunc.Dialog.response.html)

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

###  Class

#  [ Gtk ](index.html) Dialog

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

    
    
    class Gtk.Dialog : Gtk.Window
      implements Atk.ImplementorIface, Gtk.Buildable {
      /* No available fields */
    }

Dialog boxes are a convenient way to prompt the user for a small amount of
input, e.g. to display a message, ask a question, or anything else that does
not require extensive effort on the user’s part.

GTK  \+ treats a dialog as a window split vertically. The top section is a `
GtkVBox ` , and is where widgets such as a ` GtkLabel ` or a ` GtkEntry `
should be packed. The bottom area is known as the “action area”. This is
generally used for packing buttons into the dialog which may perform functions
such as cancel, ok, or apply.

` GtkDialog ` boxes are created with a call to ` gtk_dialog_new() ` or
gtk_dialog_new_with_buttons(). ` gtk_dialog_new_with_buttons() ` is
recommended; it allows you to set the dialog title, some convenient flags, and
add simple buttons.

If “dialog” is a newly created dialog, the two primary areas of the window can
be accessed through ` gtk_dialog_get_content_area() ` and
gtk_dialog_get_action_area(), as can be seen from the example below.

A “modal” dialog (that is, one which freezes the rest of the application from
user input), can be created by calling ` gtk_window_set_modal() ` on the
dialog. Use the GTK_WINDOW() macro to cast the widget returned from `
gtk_dialog_new() ` into a ` GtkWindow ` . When using `
gtk_dialog_new_with_buttons() ` you can also pass the #GTK_DIALOG_MODAL flag
to make a dialog modal.

If you add buttons to ` GtkDialog ` using gtk_dialog_new_with_buttons(),
gtk_dialog_add_button(), gtk_dialog_add_buttons(), or
gtk_dialog_add_action_widget(), clicking the button will emit a signal called
` GtkDialog::response ` with a response  ID  that you specified.  GTK  \+ will
never assign a meaning to positive response IDs; these are entirely user-
defined. But for convenience, you can use the response IDs in the `
GtkResponseType ` enumeration (these all have values less than zero). If a
dialog receives a delete event, the ` GtkDialog::response ` signal will be
emitted with a response  ID  of #GTK_RESPONSE_DELETE_EVENT.

If you want to block waiting for a dialog to return before returning control
flow to your code, you can call gtk_dialog_run(). This function enters a
recursive main loop and waits for the user to respond to th