gtk-sharp 0.0.0.0 Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. 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; using GtkSharp; 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 += 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 Dialog ("Sample", win, Gtk.DialogFlags.DestroyWithParent); dialog.Modal = true; dialog.AddButton ("Close", 5); dialog.Response += new ResponseHandler (on_dialog_response); dialog.Run (); dialog.Destroy (); } void on_dialog_response (object obj, ResponseArgs args) { Console.WriteLine (args.ResponseId); } void on_win_delete (object obj, DeleteEventArgs args) { Application.Quit (); } } } Gtk.Window Atk.Implementor GLib.IWrapper GLib.IWrapper System.IDisposable Method System.Void Adds an activatable widget to the of a . an object of type . an object of type . 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 System.Int32 Waits for the event or the to be detroyed. 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 System.Void Emits the event with the given response ID. an object of type . 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. Method Gtk.Widget Adds a with the given text. an object of type . an object of type . 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. Method System.Void A convenient way to sensitize/desensitize dialog buttons. an object of type . an object of type . Sets = for each widget in the with the given response_id. A convenient way to sensitize/desensitize dialog buttons. Method System.Void Disposes the resources associated with the object. Constructor Internal constructor Pointer to the C object. An instance of Dialog, wrapping the C object. This is an internal constructor, and should not be used by user code. Constructor Creates a new dialog box. an object of type . Creates a new dialog box. This is an internal constructor, and should not be used by user code. Constructor Creates a new dialog box. an object of type . an object of type . an object of type . an object of type . 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 (). Property System.UInt32 The for . The for the class. Property Gtk.VBox To be added an object of type To be added Property Gtk.VBox To be added an object of type . To be added Property System.Int32 Sets the default response_id. an object of type an object of type Sets the default response_id. Property System.Boolean Whether to display a . an object of type an object of type Whether to display a in the above the Event GtkSharp.ResponseHandler To be added 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. Event System.EventHandler To be added To be added Constructor Internal constructor GLib type for the type Creates a new instance of Dialog, using the GLib-provided type This is a constructor used by derivative types of that would have their own GLib type assigned to it. This is not typically used by C# code.