diff options
Diffstat (limited to 'library/ttk/menubutton.tcl')
-rw-r--r-- | library/ttk/menubutton.tcl | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/library/ttk/menubutton.tcl b/library/ttk/menubutton.tcl index a245df8..a0f70c9 100644 --- a/library/ttk/menubutton.tcl +++ b/library/ttk/menubutton.tcl @@ -83,9 +83,8 @@ if {[tk windowingsystem] eq "aqua"} { set mw [winfo reqwidth $menu] set bw [winfo width $mb] set dF [expr {[winfo width $mb] - [winfo reqwidth $menu] - $menuPad}] - set entry "" set entry [::tk::MenuFindName $menu [$mb cget -text]] - if {$entry eq ""} { + if {$entry < 0} { set entry 0 } set x [winfo rootx $mb] @@ -124,25 +123,24 @@ if {[tk windowingsystem] eq "aqua"} { incr mh 6 incr mw 16 } - set entry {} set entry [::tk::MenuFindName $menu [$mb cget -text]] - if {$entry eq {}} { + if {$entry < 0} { set entry 0 } set x [winfo rootx $mb] set y [winfo rooty $mb] switch [$mb cget -direction] { above { - set entry {} + set entry "" incr y -$mh # if we go offscreen to the top, show as 'below' if {$y < [winfo vrooty $mb]} { set y [expr {[winfo vrooty $mb] + [winfo rooty $mb]\ - + [winfo reqheight $mb]}] + + [winfo reqheight $mb]}] } } below { - set entry {} + set entry "" incr y $bh # if we go offscreen to the bottom, show as 'above' if {($y + $mh) > ([winfo vrooty $mb] + [winfo vrootheight $mb])} { @@ -196,7 +194,7 @@ proc ttk::menubutton::Pulldown {mb} { $mb state pressed $mb configure -cursor [$menu cget -cursor] foreach {x y entry} [PostPosition $mb $menu] { break } - if {$entry ne {}} { + if {$entry >= 0} { $menu post $x $y $entry } else { $menu post $x $y @@ -228,7 +226,7 @@ proc ttk::menubutton::TransferGrab {mb} { # proc ttk::menubutton::FindMenuEntry {menu s} { set last [$menu index last] - if {$last eq "none" || $last eq ""} { + if {$last eq "none" || $last < 0} { return "" } for {set i 0} {$i <= $last} {incr i} { |