Description
This Tk widget enables you to create a flat (i.e. no submenus) menu in
a specified frame. You can associate a label (that which appears on the
top menu button), a name (that which appears in the menu list) and a
value (whatever you like, it may be different from the label) for each
menu item. When you select one of the items in the menu, the label of
the menu button changes to reflect the label of the selected item.
If your list of items is very long, a menu may be too long to sensibly
manage. Therefore, you can optionally choose (see constructor) to use a popup
scrolling listbox rather than a menu (it's really implemented with a
selectabelist widget).
It can be treated like any of the built in Tk widgets, and has almost all of
the same construction arguments as the button Tk widget.
Whenever a selection is made, this widget emits an event called select. In the $value of this event, you can find a record with
fields label, name and value containing that
information for the selected item. The event generation can be disabled
if you desire with the
seteventmask tool
function.
Whenever the menu is replaced with the
replace tool function, this
widget emits an event called replaced (it has no value). Note
that the tool function
extend invokes the replace function, so a replaced event is generated then as well.
The widget accepts an event called setwidth. It is the same as
calling the setwidth tool
function.
This widget is very much like the
optionmenu widget. There are two
differences. First, the extendoptionmenu menu can be extended
interactively during use. When constructed, you specify a special
symbol for the menu (defaults to the ellipsis). When the user selects
this item, you can type in a new entry in a
ahlinkdialogboxwidgets:dialogbox or use callback functions that the
programmer provides. Second, extendoptionmenu only offers you
labels for the menu items, whereas
optionmenu offers you labels, names, and
values for each menu item. The select event is also triggered when you
add an item to the menu.
Next: extendoptionmenu - Constructor
Up: widgets - Module
Previous: dialogbox - Constructor
 
Contents
 
Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc.,
Washington, D.C.
Return to AIPS++ Home Page
2006-10-15