From: SourceForge.net <no...@so...> - 2006-03-15 23:17:47
|
Bugs item #940760, was opened at 2004-04-23 14:17 Message generated for change (Comment added) made by vincentdarley You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=940760&group_id=12997 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 11. Aqua Menus >Group: development: 8.5a4 Status: Open Resolution: None >Priority: 8 Submitted By: Vince Darley (vincentdarley) Assigned to: Jim Ingham (wolfsuit) Summary: TkAqua: menu rebuild bug Initial Comment: This simple test case illustrates a bug in TkAqua's menu handling: menu .menu menu .menu.one proc rebuild {} { destroy .menu.one.two menu .menu.one.two for {set i 0} {$i < 10} {incr i} { .menu.one.two add command -label "item $i" \ -command "puts $i" } .menu.one.two add command -label "rebuild" \ -command rebuild } rebuild .menu.one add cascade -menu .menu.one.two -label "sub" .menu.one add command -label dummy .menu add cascade -menu .menu.one -label "test" . configure -menu .menu Paste the above code into TkAqua's console, click on the main window to have the 'test' menu appear in the main OS menubar and then go down to the submenu and select 'rebuild'. This command will destroy the menu, but then rebuild it as is so everything should be the same. However, if you return to the menubar and try to post the submenu again, you'll find it won't post. Now click over to the Finder, or some other application and then back to Wish, and you'll find the menu now works! Somehow the menu->submenu connection is forgotten when the menu is rebuilt, and is only set correctly again when we switch context from/to TkAqua. ---------------------------------------------------------------------- >Comment By: Vince Darley (vincentdarley) Date: 2006-03-15 23:17 Message: Logged In: YES user_id=32170 Still in latest release ---------------------------------------------------------------------- Comment By: Russell Owen (reowen) Date: 2005-10-01 00:46 Message: Logged In: YES user_id=431773 Here is a test script. I couldn't find the button to attach a file, so I've just pasted it in. # menubar bug test script for Aqua Tk # Instructions: # - run wish # - paste in this text # - the Test menu should work fine # - click either button to trigger the bug: # - the cascading menu now does not appear on Tk Aqua # - bring any other window to the front # - bring this test window to the front # - the cascading menu now works # I have seen this on Tk Aqua 8.4.11 and earier versions # I have not seen this on unix menu .menubar . config -menu .menubar menu .menubar.test .menubar add cascade -label Test -menu .menubar.test menu .menubar.test.a3sub menu .menubar.test.b4sub proc setMenuA { } { .menubar.test delete 0 "end" .menubar.test add command -label A1 .menubar.test add command -label A2 .menubar.test add cascade -label A3Sub -menu .menubar.test.a3sub .menubar.test.a3sub delete 0 "end" .menubar.test.a3sub add command -label A3-1 .menubar.test.a3sub add command -label A3-2 } proc setMenuB { } { .menubar.test delete 0 "end" .menubar.test add command -label B1 .menubar.test add command -label B2 .menubar.test add command -label B3 .menubar.test add cascade -label B4Sub -menu .menubar.test.b4sub .menubar.test.b4sub delete 0 "end" .menubar.test.b4sub add command -label B4-1 .menubar.test.b4sub add command -label B4-2 .menubar.test add command -label B5 } setMenuA frame .spacer -width 10 -height 10 pack .spacer button .menuABut -text MenuA -command setMenuA pack .menuABut button .menuBBut -text MenuB -command setMenuB pack .menuBBut ---------------------------------------------------------------------- Comment By: Russell Owen (reowen) Date: 2005-09-23 17:33 Message: Logged In: YES user_id=431773 I also see this. I find that another way to restore operation is for the user to select another of my application's toplevels. Once that is done, the rebuilt menu works normally. (Note: the menu bar is not visibly changing; my application's menu bar is assigned to "." so all toplevels see the exact same menu bar). A horrible hack to work around the problem is: - the menu bar item's postcommand checks if the menu needs to be rebuilt. If a rebuild is needed: - rebuid the menu - create a new toplevel - update idletasks - destroy the toplevel Unfortunately, this hack is not perfect because the first time the menu is displayed when it needs rebuilding, sub-menus are NOt usable. But next time the user uses the same menu, sub-menus ARE usable. The imperfection of the hack might possibly be related to a different known menu bug in Aqua: PR 1068293 "TkAqua: CompleteIdlers() is never called for menubar menus" http://sourceforge.net/tracker/index.php? func=detail&aid=1068293&group_id=12997&atid=112997 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=940760&group_id=12997 |