svn path=/trunk/gtk-sharp/; revision=35664
This commit is contained in:
Miguel de Icaza 2004-11-04 19:59:38 +00:00
parent 8d94d831e8
commit ce819aa39f
2 changed files with 83 additions and 8 deletions

View file

@ -72,6 +72,79 @@ namespace GtkDialogSample
} }
} }
} }
</code>
</example>
<para>
You also can subclass the <see cref="T:Gtk.Dialog" /> when you want to use the same Dialog on several places in your application.
</para>
<example>
<code lang="C#">
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 ();
}
}
}
</code> </code>
</example> </example>
</remarks> </remarks>

View file

@ -221,6 +221,8 @@ public class TreeViewDemo {
} }
</code> </code>
</example></para> </example></para>
<para>
For a example how to handle selection events see <see cref="T:Gtk.TreeSelection" /></para>
</remarks> </remarks>
</Docs> </Docs>
<Base> <Base>