summaryrefslogtreecommitdiffstats
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
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].
-rw-r--r--ChangeLog8
-rw-r--r--doc/menu.n8
-rw-r--r--library/menu.tcl24
3 files changed, 36 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 7b95157..2d6b525 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2000-04-17 Eric Melski <ericm@scriptics.com>
+ * 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].
+
* tests/grid.test: Added test for [grid propagate . 0] to not toggle.
* generic/tkGrid.c: Fixed bogus logic in [grid propagate] that
diff --git a/doc/menu.n b/doc/menu.n
index cd3ad0a..44a7a8e 100644
--- a/doc/menu.n
+++ b/doc/menu.n
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: menu.n,v 1.2 1998/09/14 18:22:57 stanton Exp $
+'\" RCS: @(#) $Id: menu.n,v 1.3 2000/04/17 19:32:00 ericm Exp $
'\"
.so man.macros
.TH menu n 4.1 Tk "Tk Built-In Commands"
@@ -236,6 +236,12 @@ menu's items will be displayed in a menubar accross the top of the
window. These menus will behave according to the interface guidelines
of their platforms. For every menu set as a menubar, a clone menu is
made. See the \fBCLONES\fR section for more information.
+.PP
+As noted, menubars may behave differently on different platforms. One
+example of this concerns the handling of checkbuttons and radiobuttons
+within the menu. While it is permitted to put these menu elements on
+menubars, they may not be drawn with indicators on some platforms, due
+to system restrictions.
.VE
.VS
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]