summaryrefslogtreecommitdiffstats
path: root/library/demos/menu.tcl
diff options
context:
space:
mode:
authordas <das@noemail.net>2007-04-23 21:15:59 (GMT)
committerdas <das@noemail.net>2007-04-23 21:15:59 (GMT)
commitaf0756462cce85d9e88843abb1b558fbc1be39e6 (patch)
treed05530f9850fbb244956c2cdd80abfda3de610e3 /library/demos/menu.tcl
parent919ffc547d5fc3762ad48ce6305371d7d2fadb5f (diff)
downloadtk-af0756462cce85d9e88843abb1b558fbc1be39e6.zip
tk-af0756462cce85d9e88843abb1b558fbc1be39e6.tar.gz
tk-af0756462cce85d9e88843abb1b558fbc1be39e6.tar.bz2
* library/demos/goldberg.tcl: fix overwriting of widget demo global.
* library/demos/menu.tcl: on aqua, use custom MDEF and tearoffs; * library/demos/menubu.tcl: correct menubutton toplevel name. * library/demos/puzzle.tcl: fix button size & padding for aqua. * library/demos/radio.tcl: FossilOrigin-Name: 22ac054f865b462d05bd23f42c8b92b51a559be8
Diffstat (limited to 'library/demos/menu.tcl')
-rw-r--r--library/demos/menu.tcl15
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}}