Overview of Item Types
pathName create menu [option value option value ...]Menus 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 menus are created, they automatically get the tag "Menu". Menus have default event handlers which define their behavior. These event handlers are defined on the tag "Menus" for the "Run" event mode. See the section on Default Bindings for more details about the event bindings.
The following options are supported for menus:
-fill
[23] Specifies fill color of menu
-font
[24] Specifies font to use for text
-members [38]
The list of members of a menu
-pen
[45] Specifies pen color of menu
-relief [49]
Specifies how border should be rendered (raised, flat, sunken, ridge, groove)
-state [53]
State of the menu (normal, active, or disabled)
-text [56]
The text of the menu
set f1 [.pad create menuitem -text "New..."] set f2 [.pad create menuitem -text "Open..."] set f3 [.pad create menuitem -text "Save"] set f4 [.pad create menuitem -text "Save As"] set f5 [.pad create menuitem -text "Exit"] set e1 [.pad create checkboxmenuitem -text "Cut"] set e2 [.pad create menuitem -text "Copy"] set e3 [.pad create menuitem -text "Paste"] set g1 [.pad create menuitem -text "Content"] set g2 [.pad create menuitem -text "Index"] set g3 [.pad create menuitem -text "About"] set m1 [.pad create menu -members "$f1 $f2 $f3 $f4 $f5" -text "File"] set m2 [.pad create menu -members "$e1 $e2 $e3" -text "Edit"] set m3 [.pad create menu -members "$g1 $g2 $g3" -text "Help"] .pad create menubar -members "$m1 $m2 $m3" -height 30
Copyright Computer Science Department, The University of New Mexico