Hi all,
Attached is a minimal sample (for SVN trunk) that demonstrates
a problem with wxCheckListBox on wxMSW. In essence, if radio
menu items (and possibly other types as well) are added after
wxCheckListBox has been created, then these menu items are
incorrectly marked as 'ownerdrawn' and will not get rendered
properly (their radio 'dot' is missing).
I have tracked this issue down to msw/ownerdrw.cpp, where
m_nMarginWidth member variable gets its initial value from
a static variable ms_nLastMarginWidth, which I think
wxCheckListBox will leave in inconsistent state. Then, in
wx/ownerdrw.h, SetMarginWidth() member function marks the
menu item as owner drawn since its m_nMarginWidth doesn't
match the default margin width.
Hopefully someone has an idea how to properly resolve this
issue.
BTW, I originally found this bug in wxPython 2.8.10.1, but it
could also be reproduced in wx2.9 trunk.
Thanks,
Jaakko
[
checklistbox_problem.patch 1K ]
Index: samples/minimal/minimal.cpp
===================================================================
--- samples/minimal/minimal.cpp (revision 62459)
+++ samples/minimal/minimal.cpp (working copy)
@@ -141,6 +141,8 @@
// main frame
// --------------------------------------------------------------------------- -
+#include <wx/checklst.h>
+
// frame constructor
MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
@@ -148,6 +150,11 @@
// set the frame icon
SetIcon(wxICON(sample));
+ wxCheckListBox* clb = new wxCheckListBox(this, wxID_ANY);
+ clb->Append("Checkable Item 1");
+ clb->Append("Checkable Item 2");
+ clb->Append("Checkable Item 3");
+
#if wxUSE_MENUS
// create a menu bar
wxMenu *fileMenu = new wxMenu;
@@ -156,6 +163,12 @@
wxMenu *helpMenu = new wxMenu;
helpMenu->Append(Minimal_About, "&About...\tF1", "Show about dialog");
+ fileMenu->AppendRadioItem(wxID_ANY, "Disabled");
+ fileMenu->AppendRadioItem(wxID_ANY, "Almost Enabled");
+ fileMenu->AppendRadioItem(wxID_ANY, "Enabled");
+
+ fileMenu->AppendSeparator();
+
fileMenu->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
// now append the freshly created menu to the menu bar...