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).
This widget 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.
Note that the width argument can be used in three ways.
If width=-1 (the default), the menu button will be wide enough
(and of fixed width) to accomodate all of the item labels in the menu.
This means that the GUI won't jitter when you write different
length labels into it. If width=0, then the menu button
will change its width to accomodate whatever label is written
into it. If width > 0, then the button is again of fixed
width, with the width that you specify.
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, value, and index
(index of item in menu) 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.
Next: optionmenu - Constructor
Up: widgets - Module
Previous: messageline.postnoforward - Function
 
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