summaryrefslogtreecommitdiffstats
path: root/library/menu.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/menu.tcl')
-rw-r--r--library/menu.tcl34
1 files changed, 15 insertions, 19 deletions
diff --git a/library/menu.tcl b/library/menu.tcl
index 4875477..b5dd88e 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -156,16 +156,16 @@ bind Menu <Return> {
bind Menu <Escape> {
tk::MenuEscape %W
}
-bind Menu <Left> {
+bind Menu <<PrevChar>> {
tk::MenuLeftArrow %W
}
-bind Menu <Right> {
+bind Menu <<NextChar>> {
tk::MenuRightArrow %W
}
-bind Menu <Up> {
+bind Menu <<PrevLine>> {
tk::MenuUpArrow %W
}
-bind Menu <Down> {
+bind Menu <<NextLine>> {
tk::MenuDownArrow %W
}
bind Menu <KeyPress> {
@@ -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
@@ -260,7 +259,8 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
set tearoff [expr {[tk windowingsystem] eq "x11" \
|| [$menu cget -type] eq "tearoff"}]
if {[string first $w $menu] != 0} {
- error "can't post $menu: it isn't a descendant of $w (this is a new requirement in Tk versions 3.0 and later)"
+ return -code error -errorcode {TK MENUBUTTON POST_NONCHILD} \
+ "can't post $menu: it isn't a descendant of $w"
}
set cur $Priv(postedMb)
if {$cur ne ""} {
@@ -330,7 +330,7 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
$menu activate $entry
GenerateMenuSelect $menu
}
- }
+ }
right {
set x [expr {[winfo rootx $w] + [winfo width $w]}]
set y [expr {(2 * [winfo rooty $w] + [winfo height $w]) / 2}]
@@ -366,14 +366,12 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
}
}
}
- } msg]} {
+ } msg opt]} {
# Error posting menu (e.g. bogus -postcommand). Unpost it and
# reflect the error.
- set savedInfo $errorInfo
MenuUnpost {}
- error $msg $savedInfo
-
+ return -options $opt $msg
}
set Priv(tearoff) $tearoff
@@ -403,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)
@@ -532,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" || \
@@ -607,11 +603,14 @@ proc ::tk::MenuMotion {menu x y state} {
proc ::tk::MenuButtonDown menu {
variable ::tk::Priv
- global tcl_platform
if {![winfo viewable $menu]} {
return
}
+ if {[$menu index active] eq "none"} {
+ set Priv(window) {}
+ return
+ }
$menu postcascade active
if {$Priv(postedMb) ne "" && [winfo viewable $Priv(postedMb)]} {
grab -global $Priv(postedMb)
@@ -1219,8 +1218,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] \
@@ -1235,8 +1232,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,
@@ -1341,7 +1338,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 {}
}