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


next up previous contents index
Next: extendoptionmenu - Constructor Up: widgets - Module Previous: dialogbox - Constructor


extendoptionmenu - Tool



Package display
Module widgets


Postscript file available

Tk widget where the (interactively extendable) menu label changes with selection

include "extendoptionmenu.g"

Constructors
extendoptionmenu Construct an extendoptionmenu
Functions
disabled Disable or enable the extendoptionmenu widget
done Destroy ourselves
extend Extend the menu with more items
findlabel Find the index of the item with the given label
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
getpreviousindex Get the index previous to the current selection
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
setbackground Set the color of the background of the extendoptionmenu button
seteventmask Set the event mask
setforeground Set the color of the foreground of the extendoptionmenu button
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).

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