A widget used to choose from a list of valid choices
Class GtkOptionMenu
A GtkOptionMenu is a widget that allows the user to choose from a list of valid choices. The GtkOptionMenu displays the selected choice. When activated the GtkOptionMenu displays a popup GtkMenu which allows the user to make a new choice.
Using a GtkOptionMenu is simple; build a GtkMenu, by calling gtk_menu_new(), then appending menu items to it with gtk_menu_shell_append(). Set that menu on the option menu with gtk_option_menu_set_menu(). Set the selected menu item with gtk_option_menu_set_history(); connect to the "changed" signal on the option menu; in the "changed" signal, check the new selected menu item with gtk_option_menu_get_history().
As of GTK+ 2.4, GtkOptionMenu has been deprecated in favor of GtkComboBox.
Methods | |
get_history | Retrieves the index of the currently selected menu item. |
get_menu | Returns the GtkMenu associated with the GtkOptionMenu. |
remove_menu | Removes the menu from the option menu. |
set_history | Selects the menu item specified by index_ making it the newly selected value for the option menu. |
set_menu | Provides the GtkMenu that is popped up to allow the user to choose a new value. |
signal_changed | . |
Retrieves the index of the currently selected menu item.
GtkOptionMenu.get_history()
Return | index of the selected menu item, or -1 if there are no menu items |
The menu items are numbered from top to bottom, starting with 0.
Returns the GtkMenu associated with the GtkOptionMenu.
GtkOptionMenu.get_menu()
Return | the GtkMenu associated with the GtkOptionMenu. |
Removes the menu from the option menu.
GtkOptionMenu.remove_menu()
Selects the menu item specified by index_ making it the newly selected value for the option menu.
GtkOptionMenu.set_history( index )
index | the index of the menu item to select. Index values are from 0 to n-1. |
Provides the GtkMenu that is popped up to allow the user to choose a new value.
GtkOptionMenu.set_menu( menu )
menu | the GtkMenu to associate with the GtkOptionMenu. |
You should provide a simple menu avoiding the use of tearoff menu items, submenus, and accelerators.
.
GtkOptionMenu.signal_changed()