Overview of Item Types

Choicemenu Items

Choicemenu items are widgets that implement a pop-up menu. They contain a list of menuitems or checkboxmenuitems. When they are pressed, the member menuitems and checkboxmenuitems are displayed and may be selected. They always display the value of the currently selected menuitem or checkboxmenuitem. Choicemenus are created with widget commands of the following form:

pathName create choicemenu [option value option value ...]

Choicemenus are one of several widgets that are designed to mirror the functionality and usage of the standard widgets in Java's Abstract Windowing Toolkit (AWT). When choicemenus are created, they automatically get the tag "ChoiceMenu". Choicemenus have default event handlers which define their behavior. These event handlers are defined on the tag "ChoiceMenu" for the "Run" event mode. See the section on Default Bindings for more details about the event bindings.

The following options are supported for choicemenus:

-command [14] Callback that is executed when choicemenu is pressed

-fill [23] Specifies fill color of choicemenu

-font [24] Specifies font to use for text

-members [38] The list of members of a choicemenu

-pen [45] Specifies pen color of choicemenu

-relief [49] Specifies how border should be rendered (raised, flat, sunken, ridge, groove)

-state [53] State of the choicemenu (normal, active, or disabled)

-text [56] The text of the choicemenu

The following example shows how a pop-up menu can be created.

set c1 [.pad create menuitem -text "Times"]
set c2 [.pad create menuitem -text "Helvetica"]
set c3 [.pad create menuitem -text "Courier"]
.pad create choicemenu -members "$c1 $c2 $c3" -text "Font"

Pad++ Reference Manual - 20 JUN 1997

Copyright Computer Science Department, The University of New Mexico

Web Accessibility