[Gtk-sharp-list] Run Window as Modal Dialog
Daniel Morgan
monodanmorg at yahoo.com
Thu Dec 22 12:41:58 EST 2005
http://www.go-mono.com/docs/monodoc.ashx?tlink=5@ecma%3a807%23Dialog%2f
See Gtk.Dialog and Gtk.Window in monodoc.
Gtk.Dialog is a subclass of Gtk.Window. Gtk.Window has a property called Modal which we set true sets the window to modal.
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 += 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", ResponseType.Close);
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 ();
}
}
}
Evgeny Pirogov <pirogov.e at gmail.com> wrote:
Hello.
If possible, I need simple example for running Gtk.Window instance as modal dialog for other Gtk.Window.
Thanks.
_______________________________________________
Gtk-sharp-list maillist - Gtk-sharp-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20051222/71542d6c/attachment.html
More information about the Gtk-sharp-list
mailing list