Tk Source Code

View Ticket
Bounty program for improvements to Tcl and certain Tcl packages.
Ticket UUID: 058836a5ba77d754aabec2cf56054773d7fe0eac
Title: mac os x: -background instead of -fieldbackground
Type: Bug Version: 8.6.4
Submitter: anonymous Created on: 2015-11-28 18:03:11
Subsystem: 22. Style Engine Assigned To: marc_culler
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2019-04-24 16:14:40
Resolution: Fixed Closed By: marc_culler
    Closed on: 2019-04-24 16:14:40
The entry and spinbox widgets (may not be all) on Mac OS X set the fieldbackground of the widget using -background instead of -fieldbackground.

This is an cross platform incompatibility problem.

It is also a forward compatibility problem as any program that currently set this will break if this bug is fixed.
User Comments: marc_culler (claiming to be Marc Culler) added on 2019-04-24 16:14:40:

Commit c1f5badf84 to core-8-6-branch (also merged into trunk) makes -fieldbackground work correctly. For backwards compatibility, if -fieldbackground is not specified but -background is specified then the -background color is used for the -fieldbackground. Since the actual background color is not configurable on macOS this should not break any existing code.

fvogel added on 2019-04-10 18:55:23:

Assigning to Marc since I see he has committed something I see as a solution [8dff9217].

kevin_walzer added on 2015-12-12 03:54:05:
Joe English: Any thoughts on this?

anonymous (claiming to be [email protected]) added on 2015-12-11 08:13:33:
There are two possibilities:
(a) 'fieldbackground' is not documented and is meant to be used as the field background.
(b) 'fieldbackground' is simply a thematic element similar to 'lightcolor', 'darkcolor', et. al. and is simply another color element used by the themes.

But this is actually immaterial.
'background' is a supported, documented option.
And 'background' is being used on Mac OS X aqua not as the non-functional background, but as the field background.

I had to change my code to use an if statement to check for the aqua theme:
    ttk::style configure BDJ.TEntry \
        -font defentry \
        -fieldbackground [$::opt::o get UIFIELDCOLOR]
    if { $theme ne "aqua" } {
      # Again the mac is mucked up.  The background color on the
      # mac is the fieldbackground color.
      ttk::style configure BDJ.TEntry -background $bdjbg

My determination is as I first stated, it is a cross platform incompatibility problem.

anonymous (claiming to be [email protected]) added on 2015-12-11 06:39:56:
The ttk::entry, ttk::spinbox, ttk::combobox and ttk::treeview have fieldbackground.
I'm not as familiar with the older widgets, some of those may have a field background also.

Not being documented should be a separate ticket.

kevin_walzer added on 2015-12-11 03:50:38:
After taking a closer look at this, and not being familiar with "fieldbackground," I'm a bit puzzled to find that I can find no reference to "fieldbackground" in the Tk man pages as a standard configuration option. What is this option, and where is it documented? Are we even talking about something that exists?

anonymous added on 2015-11-29 19:35:33:
I know the background can't be configured.

But the widget is using -background to configure the field background on mac os x.
Linux and windows use -fieldbackground to configure the field background.

kevin_walzer added on 2015-11-29 19:17:31:
These are both native widgets, so it's possible that the background cannot be configured in the manner you are requesting--there are limitations here.