Tk Source Code

View Ticket
Login
Ticket UUID: 6286fda787587c818b4e11b532b5e4fd689aba22
Title: unix: checkbutton -selectcolor not restored properly when changed in -command
Type: Bug Version: 8.6.9 8.5.19
Submitter: anonymous Created on: 2019-04-15 15:19:14
Subsystem: 03. [*button] and [label] Assigned To: fvogel
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2019-04-28 16:18:38
Resolution: Fixed Closed By: fvogel
    Closed on: 2019-04-28 16:18:38
Description:
[This is related to Ticket UUID: 1530276]
[Unix/X11 only]

When the -command of a checkbutton with "-indicatoron false" changes the -selectcolor, the change is lost once the mouse leaves the checkbutton, since tk::CheckLeave restores the setting from when the mouse had entered the checkbutton, overwriting the users' changes.

Example:
pack [checkbutton .c -indicatoron false -variable checker_b -text CHECK -selectcolor orange -command {.c configure -selectcolor blue}]

When pressing the checkbutton, it changes to blue, but once the mouse leaves it, it goes back to orange.

IMHO tk::checkLeave should check that the -selectcolor is still what itself had configured earlier.  If not, it should not change the color.

Proposed patch attached.
User Comments: fvogel added on 2019-04-28 16:18:38:
Merged to core-8-6-branch and trunk. Thanks!

fvogel added on 2019-04-19 21:04:35:

Thank you for the report, and much more thanks for the patch!

I have reviewed the patch and I think it's OK. I have put it in branch bug-6286fda787 for easy testing.


Attachments: