Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: optionmenu - Constructor Up: widgets - Module Previous: messageline.postnoforward - Function


optionmenu - Tool



Package display
Module widgets


Postscript file available

Tk widget where the menu label changes with selection

include "optionmenu.g"

Constructors
optionmenu Construct an optionmenu
Functions
disabled Disable or enable the optionmenu widget
done Destroy ourselves
extend Extend the menu with more items
findlabel Find the index of the item with the given label
findname Find the index of the item with the given name
findvalue Find the index of the item with the given value
geteventmask Get the event mask
getindex Get the index of the current selection
getlabel Get the label of the current selection
getlabels Gets all of the labels associated with the menu
getname Get the name of the current selection
getnames Gets all of the names associated with the menu
getpreviousindex Get the index previous to the current selection
getvalue Get the value of the current selection
getvalues Gets all of the values associated with the menu
isenabled Is the optionmenu widget enabled ?
replace Replace the menu with the provided items
selectindex Select an item in the menu by index
selectlabel Select an item in the menu by label
selectname Select an item in the menu by name
selectvalue Select an item in the menu by value
setbackground Set the color of the background of the optionmenu button
seteventmask Set the event mask
setforeground Set the color of the foreground of the optionmenu button
setlabel Set the label of the optionmenu
setwidth Set the width of the optionmenu button



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 up previous contents index
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