πŸ’₯ TRENDING: WxWidgets/wxWidgets/issues/ - Complete Album!

Skip to content

Conversation

@sz5000

I think in MSW toolbar.cpp, we should handle the case if nmtbcd->nmcd.uItemState == CDIS_SELECTED to draw a custom background in dark mode. Otherwise a light blue background is draw.

Before the change:
msw_cds_selected_dark_color

After the change:
msw_cds_selected_dark_color_fix

How to get the state CDIS_SELECTED:
Click on a toolbar item and open a popup menu inside the item click handler as shown in the images.

@vadz

Thanks, I can reproduce the problem in the toolbar sample with:

diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp
index de8f87f7a4..5c287ae68a 100644
--- a/samples/toolbar/toolbar.cpp
+++ b/samples/toolbar/toolbar.cpp
@@ -959,6 +959,13 @@ void MyFrame::OnToolLeftClick(wxCommandEvent& event)

 void MyFrame::OnToolRightClick(wxCommandEvent& event)
 {
+    wxMenu menu;
+    menu.Append(wxID_ANY, "&First dummy item");
+    menu.Append(wxID_ANY, "&Second dummy item");
+    menu.AppendSeparator();
+    menu.Append(wxID_EXIT, "Exit");
+    PopupMenu(&menu);
+
     m_textWindow->AppendText(
             wxString::Format("Tool %d right clicked.\n",
                              (int) event.GetInt()));

and clicking on the "Save" button, so I'll push this soon (in a slightly modified/refactored way).

@vadz vadz closed this in 593b178 Jul 8, 2025
vadz added a commit that referenced this pull request Jul 8, 2025
The changes of 3a2d7a9 (Merge branch 'msw-toolbar-dark-bg',
2025-07-08) removed a variable that was used in the recently merged
593b178 (Fix selected toolbar buttons appearance in wxMSW dark mode,
2025-07-08), breaking the build.

Restore this variable to fix it.

See #25598, #25616.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants