- size_t nItem = ((size_t)event.GetY()) / lineheight + topcell ;
-
- if ( nItem < (size_t)m_noItems )
- {
- Check(nItem, !IsChecked(nItem) ) ;
- wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
- event.SetInt(nItem);
- event.SetEventObject(this);
- GetEventHandler()->ProcessEvent(event);
+ size_t nItem = ((size_t)event.GetY()) / lineheight + topcell ;
+
+ if ( nItem < (size_t)m_noItems )
+ {
+ Check(nItem, !IsChecked(nItem) ) ;
+ wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
+ event.SetInt(nItem);
+ event.SetEventObject(this);
+ GetEventHandler()->ProcessEvent(event);
+ }
+ //else: it's not an error, just click outside of client zone
+ }
+ else {
+ // implement default behaviour: clicking on the item selects it
+ event.Skip();