+- (void) tableViewSelectionDidChange: (NSNotification *) notification
+{
+ wxUnusedVar(notification);
+
+ int row = [self selectedRow];
+
+ if (row == -1)
+ {
+ // no row selected
+ }
+ else
+ {
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ wxListBox *list = static_cast<wxListBox*> ( impl->GetWXPeer());
+ wxCHECK_RET( list != NULL , wxT("Listbox expected"));
+
+ wxCommandEvent event( wxEVT_COMMAND_LISTBOX_SELECTED, list->GetId() );
+
+ if ((row < 0) || (row > (int) list->GetCount())) // OS X can select an item below the last item
+ return;
+
+ if ( !list->MacGetBlockEvents() )
+ list->HandleLineEvent( row, false );
+ }
+
+}
+