| |
Object
+--- Widget
+--- Container
+--- Bin
+--- Button
+--- OptionMenu
An OptionMenu is a widget that allows the user to select from a valid set of choices. The current choice is shown in the OptionMenu, and if the user clicks on the OptionMenu, it displays a popup menu consisting of all the valid choices.
This simple widget is creating using:
$option = new Gtk::OptionMenu();
To add a menu, create a new popup menu, as described in the
section on the
menu widget
,
without any tearoffs, submenus, or accelerators, and add it to
the OptionMenu using:
$option->set_menu( $popup_menu );
As you might suspect, you can retrieve the menu associated with
an OptionMenu using:
$popup_menu = $option->get_menu();
If you want to remove a menu from an OptionMenu, you may do so
with:
$option->remove_menu();
Finally, if you want to select an item in the menu, you would
use:
$option->set_history( $index );
where
$index
is the index of the menu item to select. The index value ranges
from 0 (first item) to n-1, where n is the number of items in
the menu.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |