gtk-sharp 2.12.0.0 Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. Gtk.Window Creates popup windows.

boxes are a convenient way to prompt the user for a small amount of input, eg. to display a message, ask a question, or anything else that does not require extensive effort by the user.

Gtk# treats a dialog as a window split vertically. The top section is a , and is where widgets such as a or an should be packed. The bottom area is known as the . This is generally used for packing buttons into the dialog which may perform functions such as cancel, ok, or apply. The two areas are separated by a .

The two primary areas of a dialog can be accessed as the property and the property. To set the dialog to be modal, use the property.

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

For a simple dialog, you would probably use to save yourself some effort. However, you would need to create the contents manually if you had more than a simple message in the .

`using System; using Gtk; namespace GtkDialogSample { public class GtkDialogSample { Dialog dialog; Window win; static void Main() { new GtkDialogSample (); } GtkDialogSample () { Application.Init (); win = new Window ("Test"); win.SetDefaultSize (250, 250); win.DeleteEvent += delegate { Application.Quit (); } Button btn = new Button ("Show About"); btn.Clicked += on_btn_clicked; win.Add (btn); win.ShowAll (); Application.Run (); } void on_btn_clicked (object obj, EventArgs args) { dialog = new Dialog ("Sample", win, Gtk.DialogFlags.DestroyWithParent); dialog.Modal = true; dialog.AddButton ("Close", ResponseType.Close); dialog.Response += on_dialog_response; dialog.Run (); dialog.Destroy (); } void on_dialog_response (object obj, ResponseArgs args) { Console.WriteLine (args.ResponseId); } } }`

You also can subclass the when you want to use the same Dialog on several places in your application.

`using System; using Gtk; namespace GtkDialogSample { public class MyDialog:Dialog { public MyDialog(Window w,DialogFlags f ):base("Sample", w, f) { this.Modal = true; this.AddButton ("Close", ResponseType.Close); } protected override void OnResponse (ResponseType response_id){ Console.WriteLine (response_id); } } public class GtkDialogSample { MyDialog dialog; Window win; static void Main() { new GtkDialogSample (); } GtkDialogSample () { Application.Init (); win = new Window ("Test"); win.SetDefaultSize (250, 250); win.DeleteEvent += new DeleteEventHandler (on_win_delete); Button btn = new Button ("Show About"); btn.Clicked += new EventHandler (on_btn_clicked); win.Add (btn); win.ShowAll (); Application.Run (); } void on_btn_clicked (object obj, EventArgs args) { dialog = new MyDialog(win, Gtk.DialogFlags.DestroyWithParent); dialog.Run (); dialog.Destroy (); } void on_win_delete (object obj, DeleteEventArgs args) { Application.Quit (); } } }`
- Constructor
  2.12.0.0
  Creates a new dialog box.
  Creates a new dialog box. This is an internal constructor, and should not be used by user code.
- Constructor
  2.12.0.0
  System.Obsolete
  a
  Protected Constructor.
  Chain to this constructor if you have manually registered a native value for your subclass.
- Constructor
  2.12.0.0
  Pointer to the C object.
  Internal constructor

  This is an internal constructor, and should not be used by user code.

- Constructor
  2.12.0.0
  System.ParamArray
  a title
  a parent , or for an unparented dialog.
  dialog characteristic such as modality and destruction policy.
  a list of button text/response pairs if desired.
  Creates a new dialog box.

  Creates a new with the specified title and parent widget.

  The argument can be used to make the dialog modal () and/or to have it destroyed along with its parent ().

  using System; using Gtk;

  class MainClass { public static void Main (string[] args) { Application.Init ();

  // Shows two buttons that use stock icons, and a custom button // Add button will return 1000 // Delete button will return 2000 // "My Own Butotn" will return 3000 Dialog d = new Gtk.Dialog ("What to do?", null, DialogFlags.Modal, Stock.Add, 1000, Stock.Delete, 2000, "My Own Button", 3000); int response = d.Run (); if (response == (int) ResponseType.DeleteEvent) Console.WriteLine ("The user closed the dialog box");

  Console.WriteLine (response); } }
- Property
  2.12.0.0
  Gtk.HButtonBox The area of the Dialog where the action widgets are placed. a
- Method
  2.12.0.0
  System.Void `` `` a a Adds an activatable widget to the of a . Adds an activatable to the of a , connecting a signal handler that will on the when the is activated. The is appended to the end of the . If you want to add a non-activatable , simply pack it into the field of the .
- Method
  2.12.0.0
  System.Void `` `` an object of type . an object of type . Adds an activatable widget to the of a . Adds an activatable to the of a , connecting a signal handler that will on the when the is activated. The is appended to the end of the . If you want to add a non-activatable , simply pack it into the field of the .
- Method
  2.12.0.0
  Gtk.Widget `` `` a , text for the button a , the numeric response code emitted when the button is pressed. Adds a new response button to the dialog. a representing the button added.
- Method
  2.12.0.0
  Gtk.Widget `` `` an object of type . an object of type . Adds a with the given text. an object of type Adds a with the given text (or a stock button, if button_text is a stock ID) and sets things up so that clicking the will emit a with the given response_id. The is appended to the end of the . The is returned, but usually you do not need it.
- Property
  2.12.0.0
  System.Int32[] AlternativeButtonOrder property. An array of Response IDs. Sets the button order to an alternative arrangement when the gtk-alternive-button-order setting is .
- Event
  2.12.0.0
  GLib.Signal("close")
  System.EventHandler Emitted when the dialog is closed.
- Property
  2.12.0.0
  Gtk.ResponseType Sets the default response_id. a Sets the default response_id.
- Method
  2.12.0.0
  System.Int32 `` A in the action area of the dialog. Gets the response id associated with an action area Widget. an representing the response id or if the widget has no response id set.
- Property
  2.12.0.0
  GLib.GType GType Property. a Returns the native value for .
- Property
  2.12.0.0
  GLib.Property("has-separator")
  System.Boolean Whether to display a . an object of type Whether to display a in the above the
- Method
  2.12.0.0
  GLib.DefaultSignalHandler(ConnectionMethod="OverrideClose", Type=typeof(Gtk.Dialog))
  System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event.
- Method
  2.12.0.0
  GLib.DefaultSignalHandler(ConnectionMethod="OverrideResponse", Type=typeof(Gtk.Dialog))
  System.Void `` a Default handler for the event. Override this method in a subclass to provide a default handler for the event.
- Method
  2.12.0.0
  System.Void `` a , the chosen response. Activate one of the responses.
- Method
  2.12.0.0
  System.Void `` an object of type . Emits the event with the given response ID. Emits the event with the given response ID. Used to indicate that the user has responded to the in some way; typically either you or will be monitoring the event and take appropriate action.
- Event
  2.12.0.0
  GLib.Signal("response")
  Gtk.ResponseHandler Emitted when an action widget is clicked, the receives a delete event, or the application programmer calls . On a delete event, the response ID is . Otherwise, it depends on which action widget was clicked.
- Method
  2.12.0.0
  System.Int32 Waits for the event or the to be destroyed. an object of type .

  Waits for the event or the to be destroyed. If the is destroyed during the call to , returns . Otherwise, it returns the response ID from the event. Before entering the recursive main loop, calls on the for you. Note that you still need to show any children of the yourself.

  During , the default behavior of is disabled; if the receives , it will not be destroyed as usual, and will return . Also, during the will be modal. You can force to return at any time by calling to emit the event. Destroying the during is a very bad idea, because your post-run code will not know whether the was destroyed or not.

  After returns, you are responsible for hiding or destroying the if you wish to do so.

- Method
  2.12.0.0
  System.Obsolete("Replaced by AlternativeButtonOrder property")
  System.Int32 `` a To be added a To be added
- Method
  2.12.0.0
  System.Void `` `` a a A convenient way to sensitize/desensitize dialog buttons. Sets = for each widget in the with the given response_id. A convenient way to sensitize/desensitize dialog buttons.
- Property
  2.12.0.0
  Gtk.VBox The that contains other widgets in this dialog. an object of type .