Tk Source Code

View Ticket
Login
2016-08-22
12:26 Ticket [741434125b] ttk::combobox -> popdown menu tip status still Deleted with 5 other changes artifact: 12b2529d92 user: dkf
2014-02-12
15:46 Deleted ticket [741434125b]. artifact: 8b60ac31a8 user: oehhar
15:32 New ticket [741434125b]. artifact: fd44e6dd34 user: egaudry

Ticket UUID: 741434125b7cf58f51b46a7c02b950c55001e741
Title: ttk::combobox -> popdown menu tip
Type: Patch Version: 8.5.15
Submitter: egaudry Created on: 2014-02-12 15:32:48
Subsystem: 88. Themed Tk Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Deleted Last Modified: 2016-08-22 12:26:39
Resolution: Duplicate Closed By: dkf
    Closed on: 2016-08-22 12:26:39
Description:
Hi there,

The idea of this patch is to allow for large string value being displayed correctly, whatever the width of the combobox itself.
Regards,

Eloi



Index: combobox.tcl
===================================================================
--- combobox.tcl        (revision 72244)
+++ combobox.tcl        (working copy)
@@ -374,11 +374,19 @@
     }

     set H [winfo reqheight $popdown]
+    set W [winfo reqwidth $popdown]
     if {$y + $h + $H > [winfo screenheight $popdown]} {
        set Y [expr {$y - $H}]
     } else {
        set Y [expr {$y + $h}]
     }
+    set values [$cb cget -values]
+    set font [$cb cget -font]
+    foreach val $values {
+      set lval [string len $val]
+      set mwidth [font measure $font " $val"]
+      if {$W<$mwidth} { set w $mwidth }
+    }
     wm geometry $popdown ${w}x${H}+${x}+${Y} }
User Comments: oehhar added on 2014-02-12 15:46:04:

Duplicate of [1c3f6f3736]