# menu.tcl --
#
# This demonstration script creates a window with a bunch of menus
# and cascaded menus.
#
# SCCS: @(#) menu.tcl 1.7 96/04/12 11:57:35
set w .menu
catch {destroy $w}
toplevel $w
label $w.msg -font $font -wraplength 4i -justify left -text "This window contains a collection of menus and cascaded menus. You can post a menu from the keyboard by typing Alt+x, where \"x\" is the character underlined on the menu. You can then traverse among the menus using the arrow keys. When a menu is posted, you can invoke the current entry by typing space, or you can invoke any entry by typing its underlined character. If a menu entry has an accelerator, you can invoke the entry without posting the menu just by typing the accelerator."
menu $m
$m add command -label "Open ..." -command {error "this is just a demo: no action has been defined for the \"Open ...\" entry"}
$m add command -label "New" -command {error "this is just a demo: no action has been defined for the \"New\" entry"}
$m add command -label "Save" -command {error "this is just a demo: no action has been defined for the \"Save\" entry"}
$m add command -label "Save As ..." -command {error "this is just a demo: no action has been defined for the \"Save As ...\" entry"}
$m add command -label "Print Setup ..." -command {error "this is just a demo: no action has been defined for the \"Print Setup ...\" entry"}
$m add command -label "Print ..." -command {error "this is just a demo: no action has been defined for the \"Print ...\" entry"}
menu $m
}
menu $m
menu $m
-command "showVars $w.menu.cascade.dialog oil trans brakes lights"
menu $m
-command "showVars $w.menu.cascade.dialog pointSize style"
menu $m
-command {
tk_dialog .pattern {Bitmap Menu Entry} {The menu entry you invoked displays a bitmap rather than a text string. Other than this, it is just like any other menu entry.} {} 0 OK
}
}
menu $m
foreach i {{An entry} {Another entry} {Does nothing} {Does almost nothing} {Make life meaningful}} {
}
menu $m
-command [list puts "You invoked \"$i\""]
}