I need a Checkbox component, but without a label. I tried just putting "" for the label on a wxCheckBox, but when I click the checkbox, it still highlights this empty area to the side of the checkbox. (At least on Ubuntu.)
After some googling, I found an implementation that someone wrote for a checkbox without a label: http://olecam.online.fr/wxNoLabelCheckBox/
It seems to work great, looks like a checkbox, but no nasty empty highlights to the side.
The downside is that it doesn't seem to fire any events when it is changed. I don't understand how events work super well yet in wxWidgets, but my guess is that this happens because the checkbox inherits from wxStaticBitmap, which dispatches zero events.
So what I would like to accomplish, is to modify this component so that it dispatches a wxEVT_COMMAND_CHECKBOX_CLICKED event, just like the normal wxCheckBox.
I added this to the OnClicked Method:
Code: Select all
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, GetId());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
Thanks!