Checked List Control for wxWidgets

For any people who are looking for a checked list component for wxWidgets– you might find this article revealing.

I’ve been using wxWidgets for a couple of months and I have to say it’s awesome. But, when I looked in the docs for a checked list control, I was not very excited to find that it does not exist in the 2.8.10 release. After doing some googling, I found the wiki page that gives some hints on using a subclass of wxListCtrl as a checked list control.

The wiki will tell you get the .cpp and the .h from the webupdate component page. The specific files I used can be downloaded from these locations:

  1. download the latest wxcheckedlistctrl.php revision from this page:
  2. download the latest revision for wxcheckedlistctrl.h from:
  3. download the bitmap images from:

then edit the wxcheckedlistctrl.h to point to the right xpm images for the control. Include the .h and .cpp files in your project. I had to write a few additional hacks to the .h file but I got it to work just fine. There are a couple of methods not implemented in the implementation file. Today I spent quite a while trying to sort the items in the list using the SortItems method, then found out that It wasn’t implemented. Below, is the SortItems method for wxCheckedListCtrl as written by me, each row should have a unique value set by SetItemData(..)

bool SortItems(wxListCtrlCompare c, long le)
long ic = GetItemCount();
long *b_CE = new long[ic*2];    // first half is checked.. 2nd is enabled

long chc = 0, enc = 0;
for(long l=0;l<ic;++l)
b_CE[chc++] = GetItemData(l);
b_CE[ic+(enc++)] = GetItemData(l);

if(!wxListCtrl::SortItems(c, le))
delete [] b_CE;
return false;

for(long l=0;l<ic;++l)
for(long l2=0;l2<chc;l2++)
if(b_CE[l2] == GetItemData(l))
Check(l, true);
for(long l2=0;l2<enc;l2++)
if(b_CE[ic+l2] == GetItemData(l))
Enable(l, true);

delete [] b_CE;
//             wxASSERT_MSG(0, wxT("Not implemented yet ! sorry... ")); return FALSE;
return true;