diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-12-12 11:13:54 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-12-12 11:13:54 (GMT) |
commit | c51d6bc0892201d0a21d39fc41810fb04dfc8975 (patch) | |
tree | add050d484e8ddd4a8116b4ebbbd8fac360ea3c7 /library | |
parent | 47aad1f41131e040dc498a7acef41f76c77f3d4c (diff) | |
download | tk-c51d6bc0892201d0a21d39fc41810fb04dfc8975.zip tk-c51d6bc0892201d0a21d39fc41810fb04dfc8975.tar.gz tk-c51d6bc0892201d0a21d39fc41810fb04dfc8975.tar.bz2 |
Fix [438a0a79d8] and [d498db461a], both related to -underline handling
Diffstat (limited to 'library')
-rw-r--r-- | library/menu.tcl | 9 | ||||
-rw-r--r-- | library/ttk/notebook.tcl | 8 |
2 files changed, 9 insertions, 8 deletions
diff --git a/library/menu.tcl b/library/menu.tcl index ba7acf1..446718f 100644 --- a/library/menu.tcl +++ b/library/menu.tcl @@ -906,13 +906,12 @@ proc ::tk::MenuFind {w char} { } set last [$child index last] for {set i [$child cget -tearoff]} {$i <= $last} {incr i} { - if {[$child type $i] eq "separator"} { + if {([$child type $i] eq "separator") || ([$child entrycget $i -state] eq "disabled")} { continue } - set char2 [string index [$child entrycget $i -label] \ - [$child entrycget $i -underline]] - if {$char eq [string tolower $char2] || $char eq ""} { - if {[$child entrycget $i -state] ne "disabled"} { + set underline [$child entrycget $i -underline] + if {$underline >= 0} { + if {$char eq [string tolower [string index [$child entrycget $i -label] $underline]]} { return $child } } diff --git a/library/ttk/notebook.tcl b/library/ttk/notebook.tcl index 7fb0ad5..55aaa03 100644 --- a/library/ttk/notebook.tcl +++ b/library/ttk/notebook.tcl @@ -140,9 +140,11 @@ proc ttk::notebook::MnemonicTab {nb key} { foreach tab [$nb tabs] { set label [$nb tab $tab -text] set underline [$nb tab $tab -underline] - set mnemonic [string toupper [string index $label $underline]] - if {$mnemonic ne "" && $mnemonic eq $key} { - return $tab + if {$underline >= 0} { + set mnemonic [string toupper [string index $label $underline]] + if {$mnemonic ne "" && $mnemonic eq $key} { + return $tab + } } } return "" |