wxGenericTreeCtrl highlight color change

12 views
Skip to first unread message

Richard Schnell

unread,
Dec 7, 2022, 1:43:14 PM12/7/22
to wx-users
Hi, Sometime between Windows wx3.1.4 and wx3.2.0 (I just noticed it in the latter), the highlight background color for the wxGenericTreeCtrl has changed to make it much harder to read the tree node. Formerly, the highlighted tree node would be dark blue with white text. Now, it is a very light gray background with white text, almost impossible to read.

I can reproduce this in the wx3.1.4 and wx3.2.0 sample app "treectrl" as well.

However, in the regular (non-Generic) wxTreeCtrl, the highlight background color hasn't changed from before: still the nicely contrasting dark-blue background and white foreground text color.

We use the generic version primarily because the amount of indentation between each level is far less than the native version (and that's important since our tree can sometimes show very long file names).

Any ideas on why this has happened, and if there is any way to override these colors? Thanks.

Vadim Zeitlin

unread,
Dec 8, 2022, 12:25:16 PM12/8/22
to wx-u...@googlegroups.com
On Wed, 7 Dec 2022 10:41:36 -0800 (PST) Richard Schnell wrote:

RS> Hi, Sometime between Windows wx3.1.4 and wx3.2.0 (I just noticed it in the
RS> latter), the highlight background color for the wxGenericTreeCtrl has
RS> changed to make it much harder to read the tree node.

This could be related to 4a5de04ece (Fix background colour drawing in
wxGenericTreeCtrl under Mac, 2021-01-16) as this is the only relevant
change to wxGenericTreeCtrl that I see in this time frame.

RS> However, in the regular (non-Generic) wxTreeCtrl, the highlight background
RS> color hasn't changed from before: still the nicely contrasting dark-blue
RS> background and white foreground text color.

Under MSW the native wxTreeCtrl uses native highlighting which is always
going to work better than whatever we do (even if, normally, we try to
emulate it).

RS> We use the generic version primarily because the amount of indentation
RS> between each level is far less than the native version (and that's
RS> important since our tree can sometimes show very long file names).

Honestly, I'd still use the native control in your case, this doesn't seem
like a good argument to compensate for all the other drawbacks of using the
generic version.

RS> Any ideas on why this has happened, and if there is any way to override
RS> these colors? Thanks.

There is no way to override the highlight colours, but they're supposed to
"work", i.e. provide enough contrast and normally should be the same as the
ones used by the native control. I don't know why this doesn't happen, it
would need to be debugged when I have time for it. In the meanwhile, please
open an issue for this and, of course, if you can debug it yourself, it
would be most welcome.

Thanks,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Reply all
Reply to author
Forward
0 new messages