public static void Main(string[] args) { Gtk.Window window; EventBox eventbox; Label label; Application.Init(); window = new Gtk.Window ("Eventbox"); window.DeleteEvent += new DeleteEventHandler (delete_event); window.BorderWidth = 10; window.Resize(400,300); eventbox = new EventBox (); window.Add (eventbox); eventbox.Show(); label = new Label ("Click here to quit"); eventbox.Add(label); label.Show(); label.SetSizeRequest(110, 20); eventbox.ButtonPressEvent += new ButtonPressEventHandler (exitbutton_event); eventbox.Realize(); window.Show(); Application.Run(); }
private void AddButtonToStatusWindow(string buttonName, int buttonID) { TextIter iter = StatusWindow.Buffer.EndIter; TextChildAnchor anchor = StatusWindow.Buffer.CreateChildAnchor(ref iter); EventBox box = new EventBox(); ApsimNG.Classes.CustomButton moreInfo = new ApsimNG.Classes.CustomButton(buttonName, buttonID); moreInfo.Clicked += ShowDetailedErrorMessage; box.Add(moreInfo); StatusWindow.AddChildAtAnchor(box, anchor); box.ShowAll(); box.Realize(); box.ShowAll(); moreInfo.ParentWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Arrow); }
public SharpApp() : base("EventBox Example") { SetDefaultSize(230,150); SetPosition(WindowPosition.Center); DeleteEvent += delegate {Application.Quit();}; EventBox ebox = new EventBox(); Add(ebox); ebox.Show(); Label label = new Label("Do Not Touch"); ebox.Add(label); label.Show(); label.SetSizeRequest(110,20); ebox.ButtonPressEvent += delegate{ System.Console.WriteLine("Hello");}; ebox.Realize(); Show(); }