gtk-sharp 2.12.0.0 Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. Gtk.Button System.Obsolete A widget used to choose from a list of valid choices.

A is a widget that allows the user to choose from a list of valid choices. The displays the selected choice. When activated the displays a popup which allows the user to make a new choice.

Using a is simple; build a , by calling , then appending s to it with . Set that menu on the with . Set the selected with ; connect to the event ; when the event occurs, check the new selected with .

`using System; using Gtk; class OptionMenuSample { OptionMenu opt; static void Main () { new OptionMenuSample (); } OptionMenuSample () { Application.Init (); Window win = new Window ("OptionMenuSample"); win.DeleteEvent += new DeleteEventHandler (OnWinDelete); // set up the OptionMenu opt = new OptionMenu (); opt.Changed += new EventHandler (OnOptionChanged); Menu m = new Menu (); MenuItem miOne = new MenuItem ("One"); m.Append (miOne); MenuItem miTwo = new MenuItem ("Two"); m.Append (miTwo); MenuItem miThree = new MenuItem ("Three"); m.Append (miThree); // add children widgets to their parents opt.Menu = m; win.Add (opt); // set the OptionMenu to a value opt.SetHistory (2); win.ShowAll (); Application.Run (); } void OnOptionChanged (object o, EventArgs args) { Console.WriteLine (opt.History); } void OnWinDelete (object o, DeleteEventArgs args) { Application.Quit (); } }`
- Constructor
  2.12.0.0
  Creates a new
  This is the default constructor for
- Constructor
  2.12.0.0
  System.Obsolete
  a
  Protected Constructor.
  Chain to this constructor if you have manually registered a native value for your subclass.
- Constructor
  2.12.0.0
  Pointer to the C object.
  Internal constructor

  This is an internal constructor, and should not be used by user code.

- Event
  2.12.0.0
  GLib.Signal("changed")
  System.EventHandler Emitted when the selection is changed.
- Property
  2.12.0.0
  GLib.GType GType Property. a Returns the native value for .
- Property
  2.12.0.0
  System.Int32 Retrieves the index of the currently selected . an object of type The s are numbered from top to bottom, starting with 0.
- Property
  2.12.0.0
  GLib.Property("menu")
  Gtk.Widget The menu of options. an object of type
- Method
  2.12.0.0
  GLib.DefaultSignalHandler(ConnectionMethod="OverrideChanged", Type=typeof(Gtk.OptionMenu))
  System.Void Default handler for the event. Override this method in a subclass to provide a default handler for the event.
- Method
  2.12.0.0
  System.Void Removes the menu from the .
- Method
  2.12.0.0
  System.Void `` a Selects the menu item specified by making it the newly selected value for the .