summaryrefslogtreecommitdiffstats
path: root/library/menu.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/menu.tcl')
-rw-r--r--library/menu.tcl19
1 files changed, 9 insertions, 10 deletions
diff --git a/library/menu.tcl b/library/menu.tcl
index d05740f..a7aaa3f 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -248,7 +248,6 @@ proc ::tk::MbLeave w {
proc ::tk::MbPost {w {x {}} {y {}}} {
global errorInfo
variable ::tk::Priv
- global tcl_platform
if {[$w cget -state] eq "disabled" || $w eq $Priv(postedMb)} {
return
@@ -313,6 +312,9 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
set x [expr {[winfo rootx $w] - [winfo reqwidth $menu]}]
set y [expr {(2 * [winfo rooty $w] + [winfo height $w]) / 2}]
set entry [MenuFindName $menu [$w cget -text]]
+ if {$entry eq ""} {
+ set entry 0
+ }
if {[$w cget -indicatoron]} {
if {$entry == [$menu index last]} {
incr y [expr {-([$menu yposition $entry] \
@@ -333,6 +335,9 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
set x [expr {[winfo rootx $w] + [winfo width $w]}]
set y [expr {(2 * [winfo rooty $w] + [winfo height $w]) / 2}]
set entry [MenuFindName $menu [$w cget -text]]
+ if {$entry eq ""} {
+ set entry 0
+ }
if {[$w cget -indicatoron]} {
if {$entry == [$menu index last]} {
incr y [expr {-([$menu yposition $entry] \
@@ -396,7 +401,6 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
# is a posted menubutton.
proc ::tk::MenuUnpost menu {
- global tcl_platform
variable ::tk::Priv
set mb $Priv(postedMb)
@@ -525,7 +529,6 @@ proc ::tk::MbMotion {w upDown rootx rooty} {
proc ::tk::MbButtonUp w {
variable ::tk::Priv
- global tcl_platform
set menu [$w cget -menu]
set tearoff [expr {[tk windowingsystem] eq "x11" || \
@@ -600,7 +603,6 @@ proc ::tk::MenuMotion {menu x y state} {
proc ::tk::MenuButtonDown menu {
variable ::tk::Priv
- global tcl_platform
if {![winfo viewable $menu]} {
return
@@ -1030,7 +1032,7 @@ proc ::tk::MenuFind {w char} {
proc ::tk::TraverseToMenu {w char} {
variable ::tk::Priv
- if {$char eq ""} {
+ if {![winfo exists $w] || $char eq ""} {
return
}
while {[winfo class $w] eq "Menu"} {
@@ -1212,8 +1214,6 @@ proc ::tk::MenuFindName {menu s} {
# upper-left corner goes at (x,y).
proc ::tk::PostOverPoint {menu x y {entry {}}} {
- global tcl_platform
-
if {$entry ne ""} {
if {$entry == [$menu index last]} {
incr y [expr {-([$menu yposition $entry] \
@@ -1228,8 +1228,8 @@ proc ::tk::PostOverPoint {menu x y {entry {}}} {
if {[tk windowingsystem] eq "win32"} {
# osVersion is not available in safe interps
set ver 5
- if {[info exists tcl_platform(osVersion)]} {
- scan $tcl_platform(osVersion) %d ver
+ if {[info exists ::tcl_platform(osVersion)]} {
+ scan $::tcl_platform(osVersion) %d ver
}
# We need to fix some problems with menu posting on Windows,
@@ -1334,7 +1334,6 @@ proc ::tk::GenerateMenuSelect {menu} {
proc ::tk_popup {menu x y {entry {}}} {
variable ::tk::Priv
- global tcl_platform
if {$Priv(popup) ne "" || $Priv(postedMb) ne ""} {
tk::MenuUnpost {}
}