using Gtk; using System; class Foo { private Entry TextEntry; static void Main() { Application.Init (); /* Create and setup widgets */ //Hbox HBox MainBox = new HBox (false, 4); //Button Button DisplayTextBtn = new Button ("Hello World"); DisplayTextBtn.Clicked += new EventHandler(DisplayEntryText); MainBox.PackStart (DisplayTextBtn); //Entry TextEntry = new Entry (); MainBox.PackStart (TextEntry); /* Create and setup window */ //Window Window win = new Window ("Detta är sparta!"); win.Add (MainBox); win.DeleteEvent += delete_event; /* Prepare and start application */ win.ShowAll (); Application.Run (); } static void delete_event (object obj, DeleteEventArgs args) { Application.Quit (); } static void DisplayEntryText (object obj, EventArgs args) { Console.WriteLine("You wrote: "+TextEntry.Text); //Application.Quit (); } }