diff options
Diffstat (limited to 'library/demos/menu.tcl')
-rw-r--r-- | library/demos/menu.tcl | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl index b9f98a3..d1b7c1c 100644 --- a/library/demos/menu.tcl +++ b/library/demos/menu.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a window with a bunch of menus # and cascaded menus using menubars. # -# RCS: @(#) $Id: menu.tcl,v 1.10 2005/08/09 07:39:19 das Exp $ +# RCS: @(#) $Id: menu.tcl,v 1.11 2007/04/23 21:16:00 das Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -19,9 +19,9 @@ wm iconname $w "menu" positionWindow $w label $w.msg -font $font -wraplength 4i -justify left -if {[string equal [tk windowingsystem] "classic"] - || [string equal [tk windowingsystem] "aqua"]} { - $w.msg configure -text "This window contains a menubar with cascaded menus. You can invoke entries with an accelerator by typing Command+x, where \"x\" is the character next to the command key symbol. The rightmost menu can be torn off into a palette by dragging outside of its bounds and releasing the mouse." +if {[tk windowingsystem] eq "aqua"} { + catch {set origUseCustomMDEF $::tk::mac::useCustomMDEF; set ::tk::mac::useCustomMDEF 1} + $w.msg configure -text "This window has a menubar with cascaded menus. You can invoke entries with an accelerator by typing Command+x, where \"x\" is the character next to the command key symbol. The rightmost menu can be torn off into a palette by selecting the first item in the menu." } else { $w.msg configure -text "This window contains a menubar with 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. The rightmost menu can be torn off into a palette by selecting the first item in the menu." } @@ -56,8 +56,7 @@ set m $w.menu.basic $w.menu add cascade -label "Basic" -menu $m -underline 0 menu $m -tearoff 0 $m add command -label "Long entry that does nothing" -if {[string equal [tk windowingsystem] "classic"] - || [string equal [tk windowingsystem] "aqua"]} { +if {[tk windowingsystem] eq "aqua"} { set modifier Command } elseif {$tcl_platform(platform) == "windows"} { set modifier Control @@ -144,7 +143,7 @@ $m entryconfigure "Does almost nothing" -bitmap questhead -compound left \ set m $w.menu.colors $w.menu add cascade -label "Colors" -menu $m -underline 1 -menu $m +menu $m -tearoff 1 foreach i {red orange yellow green blue} { $m add command -label $i -background $i -command [list \ puts "You invoked \"$i\"" ] @@ -160,3 +159,5 @@ bind Menu <<MenuSelect>> { set menustatus $label update idletasks } + +if {[tk windowingsystem] eq "aqua"} {catch {set ::tk::mac::useCustomMDEF $origUseCustomMDEF}} |