diff --git a/doc/ChangeLog b/doc/ChangeLog index 25a7d5553..94e44070c 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2003-07-18 John Luke + + * en/Gtk/OptionMenu.xml: documented + 2003-07-18 John Luke * en/Gtk/TreeView.xml: add TreeViewDemo example diff --git a/doc/en/Gtk/OptionMenu.xml b/doc/en/Gtk/OptionMenu.xml index 65edd8bc5..688b6c186 100644 --- a/doc/en/Gtk/OptionMenu.xml +++ b/doc/en/Gtk/OptionMenu.xml @@ -1,5 +1,5 @@ - + gtk-sharp 0.0.0.0 @@ -7,8 +7,77 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added - To be added + 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; +using GtkSharp; + +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 (); + } +} + + Gtk.Button @@ -37,8 +106,8 @@ - To be added - To be added + Removes the menu from the . + @@ -63,7 +132,7 @@ Internal constructor Pointer to the C object. - An instance of OptionMenu, wrapping the C object. + An instance of , wrapping the C object. This is an internal constructor, and should not be used by user code. @@ -75,9 +144,9 @@ - To be added - To be added: an object of type 'Gtk.OptionMenu' - To be added + Creates a new + an object of type + This is the default constructor for @@ -87,8 +156,8 @@ System.UInt32 - The GLib Type for Gtk.OptionMenu - The GLib Type for the Gtk.OptionMenu class. + The for + The for the class. @@ -99,9 +168,9 @@ System.Int32 - To be added - To be added: an object of type 'int' - To be added + Retrieves the index of the currently selected . + an object of type + The s are numbered from top to bottom, starting with 0. @@ -114,10 +183,10 @@ - To be added - To be added: an object of type 'Gtk.Widget' - To be added: an object of type 'Gtk.Widget' - To be added + The menu of options. + an object of type + an object of type + @@ -126,8 +195,8 @@ - To be added - To be added + Emitted when the selection is changed. + @@ -156,10 +225,10 @@ - To be added + Selects the menu item specified by making it the newly selected value for the . a - To be added + - \ No newline at end of file +