Tk Source Code

View Ticket
Login
Bounty program for improvements to Tcl and certain Tcl packages.
2023-02-02
15:27 Ticket [f20f46b9] following widgets need scaling: checkbutton, radiobutton, alt theme: ttk::checkbutton, ttk::radiobutton, ttk::sizegrip (all themes) status still Open with 4 other changes artifact: 9c3a3bc2 user: nemethi
2023-01-31
20:10 Ticket [f20f46b9]: 4 changes artifact: 9bd0dd2c user: nemethi
2023-01-28
16:45 Ticket [f20f46b9]: 4 changes artifact: 79fbdd20 user: nemethi
08:19 Ticket [63549638] Aqua: huge change in appearance between commpints status still Open with 3 other changes artifact: 24c9d2ff user: fvogel
08:19 Ticket [f20f46b9] following widgets need scaling: checkbutton, radiobutton, alt theme: ttk::checkbutton, ttk::radiobutton, ttk::sizegrip (all themes) status still Open with 3 other changes artifact: 4af1f270 user: fvogel
2023-01-26
09:48 Ticket [f20f46b9]: 4 changes artifact: 86390251 user: nemethi
2023-01-24
13:31 Ticket [f20f46b9]: 4 changes artifact: 4ef383e7 user: nemethi
12:41
Made the cascade arrows of the menu entries on X11 and the values of further Ttk styling options scaling-aware. See the ticket [f20f46b9] for details. check-in: c2174181 user: csaba tags: scaling-aware-classic-simple
2023-01-12
11:36 Ticket [f20f46b9] following widgets need scaling: checkbutton, radiobutton, alt theme: ttk::checkbutton, ttk::radiobutton, ttk::sizegrip (all themes) status still Open with 4 other changes artifact: acfcfb8d user: oehhar
2023-01-05
18:03
Some progress in [f20f46b90a]. Not done yet check-in: f7faa6e9 user: jan.nijtmans tags: trunk, main
2022-12-22
20:16 Ticket [f20f46b9] following widgets need scaling: checkbutton, radiobutton, alt theme: ttk::checkbutton, ttk::radiobutton, ttk::sizegrip (all themes) status still Open with 4 other changes artifact: 63ad44ec user: nemethi
17:27 Ticket [e9622302] Make Tk widgets "tk scale" and system scaling aware status still Closed with 6 other changes artifact: 643177f5 user: oehhar
17:25 New ticket [f20f46b9] following widgets need scaling: checkbutton, radiobutton, alt theme: ttk::checkbutton, ttk::radiobutton, ttk::sizegrip (all themes). artifact: d0dc6e6e user: oehhar

Ticket UUID: f20f46b90ac6fa9d6e4fd1ea8ab2412078a29206
Title: following widgets need scaling: checkbutton, radiobutton, alt theme: ttk::checkbutton, ttk::radiobutton, ttk::sizegrip (all themes)
Type: Bug Version: main
Submitter: oehhar Created on: 2022-12-22 17:25:22
Subsystem: 02. Appearance Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2023-02-02 15:27:48
Resolution: None Closed By: nobody
    Closed on:
Description:

The following information by Csaba in [e9622302] is not solved.

So copy it to this ticket to not forget it. It is probably a long term bug for later fixing...

Csaba:

Unfortunately, the indicators of the Tk core checkbuttons and radiobuttons are not scalable. Nor are the indicators of the ttk::checkbutton and ttk::radiobutton widgets of the alt theme. This problem can only be solved by reworking the C code in such a way that the sizes of the indicators become dynamic (depending on [tk scaling]) or configurable via a new option, say, -indicatorsize (in which case the scaling could be implemented via Tcl code, like for the themes clam, classic, and default).

Same problem regarding the ttk::sizegrip widget.

User Comments: nemethi (claiming to be Csaba Nemethi) added on 2023-02-02 15:27:48:
UPDATE: As a result of merging trunk into this branch, the file unix/tkUnixButton.c has become identical to its version in trunk, hence the SVG images used for the indicators of the Tk core checkbuttons and radiobuttons now have the same 3D look rather than the former "simple", solid border.

nemethi (claiming to be Csaba Nemethi) added on 2023-01-31 20:10:21:
UPDATE: In the branch "scaling-aware-classic-simple" the indicators of the ttk::checkbutton and ttk::radiobutton widgets of the alt theme (on all windowing systems) are now scaling-aware.  The version of the file generic/ttk/ttkDefaultTheme.c (!) just committed uses SVG images that preserve the alt theme specific 3D look of the indicators.

nemethi (claiming to be Csaba Nemethi) added on 2023-01-28 16:45:56:
The goal of that commit by Jan was to make  it possible to use screen distances  in points rather than [::tk::ScaleNum ...] invocations when making the Tk and Ttk widgets scaling-aware.  In the course of this action Jan has also fixed a very long-standing and annoying bug on macOS Aqua: one point was the same as one pixel, unlike on X11 and Windows, where on an unscaled, 96 DPI screen, one pixel corresponds to 0.75 points.  When doing this, he had to make a few changes in the file macosx/tkMacOSXFont.c, too.  Yes, the price of this bug-fix is a visual incompatibility between Tk 8.7b1 and earlier Tk versions on macOS Aqua.  This was surely not intended, but could not be avoided.  I am pretty sure that this cannot be viewed as transient until the work is finished.

fvogel added on 2023-01-28 08:19:20:

We have a report [6354963816] about TkTextFont size changes having implications in the user application. These changes were triggered by [f7faa6e9d9] referring to the present ticket; this commit log says the work is not finished but nevertheless: was such a change intended? Is it perhaps transient until the work, precisely, is finished?


nemethi (claiming to be Csaba Nemethi) added on 2023-01-26 09:48:29:
CORRECTION: The indicators of the ttk::checkbutton and ttk::radiobutton widgets *of the alt theme* (on all windowing systems) are still not scaling-aware. ...

UPDATE: Brian has now merged the implementation of the Tk core checkbutton and radiobutton indicators and their counterparts for the menu entries from his branch "scaling-aware-classic-buttons" into trunk.  This is the same code as the one in the branch "scaling-aware-classic-simple", but Brian uses 3D indicator images, while mine are ones derived from some Bootstrap icons and have solid borders.  The common code logic is the result of an intensive and really fruitful collaboration between Brian and myself, for which I am very grateful.

nemethi (claiming to be Csaba Nemethi) added on 2023-01-24 13:31:56:
Brian was kind enough to open a new branch named "scaling-aware-classic-simple" and to push my version of unix/tkUnixButton.c to it, after carefully testing the implementation.  This file version makes the indicators of the ttk::checkbutton and ttk::radiobutton widgets as well as their counterparts for menu entries scaling-aware on X11.

My latest commit on this branch makes the following changes:

1. In the file library/scaling.tcl the variable ::tk::scalingPct is now read-only.  This makes the places in C modules where the value of this variable is being retrieved simpler, becouse they no longer need to check whether the variable exists and contains a positive integer (100, 125, 150, etc.).

2. In the file library/ttk/ttk.tcl the procedure ::ttk::SetTreeviewRowHeight was renamed to ::ttk::setTreeviewRowHeight and moved into the group of "Public API" procs (like ::ttk::themes and ::ttk::setTheme).  Its new placement has made it possible to invoke it in the files altTheme.tcl, clamTheme, etc. in the directory library/ttk.

3. The above-mentioned theme-settings files now contain an invocation of ::ttk::setTreeviewRowHeight and make a few further treeview-related styling options (like -indent, -indicatorsize/-diameter, and -indicatormargins) scaling-aware.

4. In the file generic/ttk/ttkTreeview.c the value of the -indent option is now retrieved via Tk_GetPixelsFromObj() rather than Tcl_GetIntFromObj().  This has made it possible to set the value of this styling option in points rather than pixels.

5. The file unix/tkUnixMenu.c now makes the cascade arrows of the menu entries on X11 scaling-aware if the variable ::tk::scalingPct exists.  Since this change is backwards-compatible, the new file version can be used not only in Tk 8.7 but also in Tk 8.6 and 8.5.


I think on X11 now pretty everything has become scaling-aware.

The indicators of the ttk::checkbutton and ttk::radiobutton widgets (on all windowing systems) are still not scaling-aware.  I have got a fully tested implementation that makes them scaling-aware, but haven't published it (yet), because it makes these indicators look just like their Tk core counterparts, and I am not sure whether this is allowed/accepted or not.

Last night Brian also made a commit, on the branch "scaling-aware-classic-buttons".  His implementation of Tk core checkbutton and radiobutton indicators is now basically identical to mine (in the "scaling-aware-classic-simple" branch), but his SVG images differ.

The Tk core checkbutton and radiobutton indicators on Windows and the ones of the winnative theme are still not scaling-aware.  Maybe someone more proficient in the Windows stuff can examine what could be done in this respect.

oehhar added on 2023-01-12 11:36:16:

Please see related work in the following branches:

  • Scaling classic check/radio buttons: Checkin [7936086d] Branch [scaling-aware-classic-buttons]
  • Slider sash sizing is done by changing the -gripcount implying, that there are two pixels per count (line of 1 pixels size). It would be great to use -gripsize: Checkin [5e436848] Branch [gripsize].

Thanks to Brian and Jan for this great work !


nemethi (claiming to be Csaba Nemethi) added on 2022-12-22 20:16:15:
Update: The indicators of the ttk::checkbutton and ttk::radiobutton widgets of the winnative theme are not scalable either.