wxWidgets V3.3.1 (and latest), Windows10, VisualStudio 2019, all compiled locally
When adapting my app to dark-mode, I found several problems in the wxListCtrl:
if you use SetHeaderAttr(), without explicit SetTextColour(), the headertext is black
moving the mouse over the normal text wil NOT highlight the text (header is ok!)
if you use mask 'wxLC_HRULES' in the creation flag, the lines are visible, but disappear when you slowly move the mouse over them. A column-resize will show the lines again
looking at the third column, it looks asif the text is clipped at the right side, also overwriting the vertical line (solved in V3.3.2?)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Hi, I think I've fixed drawing the horizontal/vertical rules just yesterday in #25999
To fix the header in dark mode, the dark mode custom header needs to be reinitialized after resetting the custom header. I'll add this to that PR, it seems to fix it for me:
diff --git "a/src/msw/listctrl.cpp" "b/src/msw/listctrl.cpp" index 5d5c1f7dc83..2c9b6a958a6 100644 --- "a/src/msw/listctrl.cpp" +++ "b/src/msw/listctrl.cpp" @@ -707,6 +707,8 @@ bool wxListCtrl::SetHeaderAttr(const wxItemAttr& attr) delete m_headerCustomDraw; m_headerCustomDraw = nullptr; + + MSWInitHeader(); } else // We do have custom attributes. {
There have been multiple dark mode listctrl improvements in the last months, so it is likely that the text clipping is resolved in v3.3.2/master.
In dark mode, the whole list is custom draw. Drawing the hover/CDIS_HOT state is currently not done.
I don't think ListView_GetNextItem allows the request this state, so this probably needs to check if the mouse is over an item or not. And then update the uItemState in HandleItemPaint, and then use a different colour in HandleSubItemPrepaint if this state is set? I'll try to look into it further.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Yes, your change above fixes the headertext in dark mode.
Thank you.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Wow, that was quick!
Your last commit solved all of the problems.
2 small remarks:
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Thanks for testing.
I tuned the padding parameters a bit, but I can't get it perfect. In these screenshot you can see light and dark mode blended together, for left aligned and right aligned columns after my changes (at 150% dpi, in case this matters and someone wants to reproduce):
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Your last changes resolve both my remarks.
Thank you for your quick response!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Hmm, I can't reproduce this. For me it is red (except when hovering over it or selecting it). The red background colour is set via the background attribute in (last line):
https://github.com/wxWidgets/wxWidgets/blob/41a7420f2d7b5de9dc9db978445f04337c7cc619/src/msw/listctrl.cpp#L3404-L3408
Is it correct in master and does my PR break it?
Maybe nmcd.uItemState can have a different state and it is not 0. And I should only check if the selected/hot flags are set. I'll update the PR with this.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()