From: SourceForge.net <no...@so...> - 2006-04-06 00:51:03
|
Bugs item #1462653, was opened at 2006-04-01 04:33 Message generated for change (Comment added) made by hobbs You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=1462653&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: 13. Win Menus Group: None Status: Open Resolution: None Priority: 5 Submitted By: Helmut Giese (hgiese) >Assigned to: Jeffrey Hobbs (hobbs) Summary: Cascading menus crash on Win98 Initial Comment: Hello, the script below crashes on Win98 under Tcl 8.4.11 and (as reported by Pat Thoyts) under 8.4.13 as well - but behaves well on Win XP. How to reproduce it: - Start the program - Click on 'Cascade' - Go to 'Next cascade' - 3 - 2 - 'Option 1' or 'Option 2' - Now without changing the state of the button leave the last menu, so that you are "outside" of this app. Without touching any other part of the menu hierarchie return with the mouse pointer to the first menu (displaying 'Next cascade'). - Move from below into this menu - BOOM. Best regards Helmut Giese --- package require Tk package require BWidget # this fires when a menu gets 'selected' proc menuSelect {w} { variable GUI if { $w ne ".#mnu" || [$w index active] != 1 } {return} # update the cascading menu # update the count $GUI(specM,subCnt) entryconfigure 0 -label 99 # update the cascade for {set val 0} {$val < 3} {incr val} { set state [expr {$val ? "normal" : "disabled"}] $GUI(specM,subVal${val}Cnt) entryconfigure 0 \ -label $val -state $state } } # create the main menu (bar) set m [menu .mnu -tearoff 0] # create the file menu set fM [menu $m.file -tearoff 0] $fM add command -label "Open" -underline 0 $fM add command -label "Save" -underline 0 $fM add separator $fM add command -label "Quit" -underline 0 # create the special menu set specM [menu $m.spec -tearoff 0] # ... its submenus: one for the count set GUI(specM,subCnt) [menu $specM.subCnt -tearoff 0] $GUI(specM,subCnt) add command -label "" # build the next level of cascading menus set GUI(specM,subVal) [menu $specM.subVal -tearoff 0] set mItem $GUI(specM,subVal) for {set i 0} {$i < 3} {incr i} { # create sub-menu for this value set subVal${i}Cnt [menu $mItem.subVal${i}Cnt -tearoff 0] set GUI(specM,subVal${i}Cnt) [set subVal${i}Cnt] # this one has a sub-menu, too set subVal${i}CntSub [menu $mItem.subVal${i}CntSub -tearoff 0] set GUI(specM,subVal${i}CntSub) [set subVal${i}CntSub] [set subVal${i}CntSub] add command -label "Option 1" [set subVal${i}CntSub] add command -label "Option 2" # add this sub-sub-menu [set subVal${i}Cnt] add cascade -label "" \ -menu [set subVal${i}CntSub] # add the sub menu $mItem add cascade -label [expr {$i+1}] \ -menu [set subVal${i}Cnt] } # put the special menu together $specM add cascade -label "Count" -underline 0 \ -menu $GUI(specM,subCnt) $specM add cascade -label "Next cascade" -underline 0 \ -menu $GUI(specM,subVal) # put everything onto the menubar $m add cascade -label "File" -underline 0 -menu $fM $m add cascade -label "Cascade" -underline 0 -menu $specM # pass on . configure -menu $m pack [MainFrame .main] .main showstatusbar none pack .main -fill x -expand yes -side top -anchor n # get the frame for the rest set f [.main getframe] set btn [button $f.btn -text "Click me"] pack $btn bind $m <<MenuSelect>> [namespace code { menuSelect %W }] ---------------------------------------------------------------------- >Comment By: Jeffrey Hobbs (hobbs) Date: 2006-04-05 17:50 Message: Logged In: YES user_id=72656 Please reconfirm with the 8.4.13 head (with my changes to tkWinMenu.c of today). ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=1462653&group_id=12997 |