summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorericm <ericm>2000-04-17 19:31:59 (GMT)
committerericm <ericm>2000-04-17 19:31:59 (GMT)
commit068d53cb54d7e92a69fdf3e9f4a6995dd23a9de8 (patch)
treea61eb957404f02f79b0e516b597ffdaf07c38246 /library
parent424e07b3f85a1f56fd99ca65cec5c2e570dcc31e (diff)
downloadtk-068d53cb54d7e92a69fdf3e9f4a6995dd23a9de8.zip
tk-068d53cb54d7e92a69fdf3e9f4a6995dd23a9de8.tar.gz
tk-068d53cb54d7e92a69fdf3e9f4a6995dd23a9de8.tar.bz2
* doc/menu.n: Added note regarding rendering of
checkbuttons/radiobuttons in menubars on different platforms -- some systems do not draw indicators for check/radiobuttons in menubars. * library/menu.tcl: Corrected behavior of checkbuttons/commands/radiobuttons in menubars [Bug: 630].
Diffstat (limited to 'library')
-rw-r--r--library/menu.tcl24
1 files changed, 21 insertions, 3 deletions
diff --git a/library/menu.tcl b/library/menu.tcl
index 6899b10..cd1260f 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -4,7 +4,7 @@
# It also implements keyboard traversal of menus and implements a few
# other utility procedures related to menus.
#
-# RCS: @(#) $Id: menu.tcl,v 1.11 2000/03/31 09:24:11 hobbs Exp $
+# RCS: @(#) $Id: menu.tcl,v 1.12 2000/04/17 19:32:00 ericm Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
@@ -655,9 +655,27 @@ proc tkMenuInvoke {w buttonRelease} {
tkMenuUnpost $w
} elseif {[string equal [$w cget -type] "menubar"]} {
$w postcascade none
- $w activate none
- event generate $w <<MenuSelect>>
+ set active [$w index active]
+ set isCascade [string equal [$w type $active] "cascade"]
+
+ # Only de-activate the active item if it's a cascade; this prevents
+ # the annoying "activation flicker" you otherwise get with
+ # checkbuttons/commands/etc. on menubars
+
+ if { $isCascade } {
+ $w activate none
+ event generate $w <<MenuSelect>>
+ }
+
tkMenuUnpost $w
+
+ # If the active item is not a cascade, invoke it. This enables
+ # the use of checkbuttons/commands/etc. on menubars (which is legal,
+ # but not recommended)
+
+ if { !$isCascade } {
+ uplevel #0 [list $w invoke $active]
+ }
} else {
tkMenuUnpost $w
uplevel #0 [list $w invoke active]