From b0025afb4ce026b34fb5108828771774c989e738 Mon Sep 17 00:00:00 2001 From: sbron Date: Tue, 28 Feb 2023 20:40:20 +0000 Subject: Fix calculation when menu doesn't fit below a ttk::menubutton. --- library/ttk/menubutton.tcl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/ttk/menubutton.tcl b/library/ttk/menubutton.tcl index fc0ea02..f98a5da 100644 --- a/library/ttk/menubutton.tcl +++ b/library/ttk/menubutton.tcl @@ -142,8 +142,7 @@ if {[tk windowingsystem] eq "aqua"} { incr y $bh # if we go offscreen to the bottom, show as 'above' if {($y + $mh) > ([winfo vrooty $mb] + [winfo vrootheight $mb])} { - set y [expr {[winfo vrooty $mb] + [winfo vrootheight $mb] \ - + [winfo rooty $mb] - $mh}] + set y [expr {[winfo vrooty $mb] + [winfo rooty $mb] - $mh}] } } left { -- cgit v0.12 From ba5edbc89b36520b759a88fb1dc6d06b7f1c0e8a Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 4 Mar 2023 15:22:47 +0000 Subject: Fix [93fe36b5a7]: <> virtual event not working for menus with -tearoff option --- library/tearoff.tcl | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/library/tearoff.tcl b/library/tearoff.tcl index 96e275f..24168cb 100644 --- a/library/tearoff.tcl +++ b/library/tearoff.tcl @@ -154,9 +154,7 @@ proc ::tk::MenuDup {src dst type} { # Copy tags to x, replacing each substring of src with dst. while {[set index [string first $src $tags]] >= 0} { - if {$index > 0} { - append x [string range $tags 0 $index-1]$dst - } + append x [string range $tags 0 $index-1]$dst set tags [string range $tags $index+$srcLen end] } append x $tags @@ -171,9 +169,7 @@ proc ::tk::MenuDup {src dst type} { # Copy script to x, replacing each substring of event with dst. while {[set index [string first $event $script]] >= 0} { - if {$index > 0} { - append x [string range $script 0 $index-1] - } + append x [string range $script 0 $index-1] append x $dst set script [string range $script $index+$eventLen end] } -- cgit v0.12 From 9e1b2798c38edb6b2ae568dc5bc99bd6b01d7f5a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 4 Mar 2023 17:24:23 +0000 Subject: Even simpler ... (@fvogel, you are right, the check for $index simply is useless here) --- library/tearoff.tcl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/tearoff.tcl b/library/tearoff.tcl index 24168cb..244b2a5 100644 --- a/library/tearoff.tcl +++ b/library/tearoff.tcl @@ -169,8 +169,7 @@ proc ::tk::MenuDup {src dst type} { # Copy script to x, replacing each substring of event with dst. while {[set index [string first $event $script]] >= 0} { - append x [string range $script 0 $index-1] - append x $dst + append x [string range $script 0 $index-1]$dst set script [string range $script $index+$eventLen end] } append x $script -- cgit v0.12