Tk Source Code

View Ticket
Login
Ticket UUID: 0e7185dc4caec945aeed9e11cbb0943c736dd28a
Title: ttk combobox selection issue
Type: Bug Version: 8.5
Submitter: anonymous Created on: 2013-07-12 16:46:23
Subsystem: 88. Themed Tk Assigned To: jenglish
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-10-22 17:22:33
Resolution: Out of Date Closed By: serhiy.storchaka
    Closed on: 2026-09-30 15:56:01
Description:
The tile combobox has a problem with the way it handles the text 
selection of the currently selected item. If items are selected from 
the drop down list the highlighting and exporting of the current item 
is adjusted to match the new item but if the selection is changed by 
modifying the textvariable the highlighting and export isn't updated 
which can result in only a portion of the currently selected item 
being highlighted and exported. 

It is the same on any platform and theme. 

toplevel .t 
pack [ttk::combobox .t.c -values "Australia India USA Europe" -textvariable combo] 
pack [ttk::entry .t.e -textvariable entry] 
set entry USA; 
set combo Australia; 

To reproduce the issue: 
1. run the above script and select the entry content byt click and drag the content right to left (not by double click) 
2. now click on the combobox button (not text area) and select any Europe. 
now you can observe that the combobox content is highlighted (blue background) only for 3 characters (Eur). 

I am running this script on Tcl version. 8.5.9 and tile 0.8.6

https://groups.google.com/forum/#!topic/comp.lang.tcl/LKNKFN1Hhoo
User Comments: serhiy.storchaka added on 2026-09-30 15:56:01:

Not reproducible with 8.6 and 9.1 on Linux/X11 and Windows: after choosing an item from the drop-down list, the whole new value is selected and exported as the PRIMARY selection. The report was for the separate Tile 0.8.6 package, not the ttk built into Tk.

Changing the -textvariable directly still keeps the selection range, as jenglish explained; entry, ttk::entry and ttk::combobox all behave the same way.


jenglish added on 2013-07-15 16:59:01:
Core entry and ttk::entry widgets work the same way -- modifying the linked variable doesn't affect sel.first or sel.last (except to ensure that they are within the bounds of the new value).

This is the intended behavior, though I'm not sure it's the Right Thing.  It might make more sense to unconditionally clear the selection whenever the value changes.