Calling wxTextCtrl::SetFont'
on a wxTextCtrl
with wxTE_RICH2
style results in black text on dark background when in dark mode.
This affects also the function wxShowTip
. This can be seen in unmodified dialogs sample (Show tip of the day CTRL+T).
The PR fixes this by copying the default style into the modified style with the new font.
https://github.com/wxWidgets/wxWidgets/pull/25856
(1 file)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Thanks, this looks correct but it potentially changes the behaviour when other attributes are set and I'm not sure if we want this. I don't have time to think about that right now, so what about applying this:
diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 96225f19f8..3ffacce605 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -3131,6 +3131,15 @@ bool wxTextCtrl::SetFont(const wxFont& font) // the default font for it. wxTextAttr attr; attr.SetFont(font); + + // In dark mode we also need to set the colours explicitly, just as we + // do for the colours of the control itself in Create(). + if ( wxMSWDarkMode::IsActive() ) + { + attr.SetTextColour(GetForegroundColour()); + attr.SetBackgroundColour(GetBackgroundColour()); + } + SetStyle(-1, -1, attr); }
instead? AFAICS it also solves the problem and doesn't raise any new questions.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.