From 475f34e019d0bc29f1769524e48650375235abf4 Mon Sep 17 00:00:00 2001 From: ericm Date: Tue, 7 Mar 2000 01:02:26 +0000 Subject: * library/menu.tcl: Added a check in tkMenuFirstEntry that changes menu behavior to only auto-post an immediate child cascade if we are currently on a menubar menu. This prevents massive auto-cascading in cases where the first entry of the cascade is itself a cascade, and the first entry of that cascade is a cascade, and the first entry of that cascade is a cascade ... [Bug: 676]. --- library/menu.tcl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/menu.tcl b/library/menu.tcl index 2c2c751..409955d 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.8 1999/09/02 17:02:52 hobbs Exp $ +# RCS: @(#) $Id: menu.tcl,v 1.9 2000/03/07 01:02:26 ericm Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. @@ -1092,7 +1092,12 @@ proc tkMenuFirstEntry menu { && [string compare [$menu type $i] "tearoff"]} { $menu activate $i tkGenerateMenuSelect $menu - if {[string equal [$menu type $i] "cascade"]} { + # Only post the cascade if the current menu is a menubar; + # otherwise, if the first entry of the cascade is a cascade, + # we can get an annoying cascading effect resulting in a bunch of + # menus getting posted (bug 676) + if {[string equal [$menu type $i] "cascade"] && \ + [string equal [$menu cget -type] "menubar"]} { set cascade [$menu entrycget $i -menu] if {[string compare $cascade ""]} { $menu postcascade $i -- cgit v0.12