nomad-software / tkd

GUI toolkit for the D programming language based on Tcl/Tk
MIT License
117 stars 16 forks source link

Some control's default background colors are wrong #11

Closed Abscissa closed 10 years ago

Abscissa commented 10 years ago

A few of the controls have their background colors set incorrectly by default (presumably using a hard-coded white instead of the proper system color for control backgrounds). Aside from not looking good, this can also result in invisible text:

http://semitwist.com/download/img/shots/tkd1.png http://semitwist.com/download/img/shots/tkd2.png

Not sure if this is just Windows or if it's happening on other platforms too.

nomad-software commented 10 years ago

Ah yes i hard coded these (i knew it would be trouble). I'll take a look at removing 'em and let the system default be used.

nomad-software commented 10 years ago

Hmm... looking at the source i removed all the hard coded colors a while ago, so that's not the issue. It looks like this is part of the default theme in Tcl/Tk.

https://github.com/nomad-software/tcltk/blob/master/dist/library/ttk/defaults.tcl#L59 https://github.com/nomad-software/tcltk/blob/master/dist/library/ttk/defaults.tcl#L94

Someone with the same issue: http://stackoverflow.com/questions/17635905/ttk-entry-background-colour

I think this is a short-coming of Tcl/Tk in general.

Abscissa commented 10 years ago

Interesting, although it looks like it may be just a series of bugs/oversights in Tk's themes. If I add -fieldbackground SystemWindow to this line:

https://github.com/nomad-software/tcltk/blob/master/dist/library/ttk/winTheme.tcl#L30

Then that particular field's background is displayed correctly (although the keyboard cursor for it becomes invisible...arggh). I have no idea how many other themes may be affected or how to properly test them (I'm completely new to both tcl and tk).

FWIW, I'm doing this on Win7 with Aero disabled.

nomad-software commented 10 years ago

I'll have another fiddle.

nomad-software commented 10 years ago

See commit: https://github.com/nomad-software/tkd/commit/c4e508eb65b3eb14290a75f141d8e799ac0987a0 for the fix to this problem. If you set to use another theme in your program (using setTheme(...)) then this problem will occur again. To avoid this you could always create your own theme and use that.