- event.m_commandInt = aSelections[0] ;
- event.m_clientData = listbox->GetClientData( event.m_commandInt );
- wxString str(listbox->GetString(event.m_commandInt));
- if (!str.IsEmpty()) event.m_commandString = str;
+ //Now, as mentioned above, we manually select the row that is/was going
+ //to be selected anyway by GTK
+ listbox->m_blockEvent = true; //if we don't block events we will lock the
+ //app due to recursion!!
+
+ GtkTreeSelection* selection =
+ gtk_tree_view_get_selection(listbox->m_treeview);
+ GtkTreeIter iter;
+ gtk_tree_model_get_iter(GTK_TREE_MODEL(listbox->m_liststore), &iter, path);
+ gtk_tree_selection_select_iter(selection, &iter);
+
+ listbox->m_blockEvent = false;
+
+ //Finally, send the wx event
+ wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
+ event.SetEventObject( listbox );
+
+ // indicate whether this is a selection or a deselection
+ event.SetExtraLong( 1 );
+
+ event.SetInt(nIndex);
+ event.SetString(wxConvUTF8.cMB2WX(gtk_tree_entry_get_label(entry)));
+
+ if ( listbox->HasClientObjectData() )
+ event.SetClientObject(
+ (wxClientData*) gtk_tree_entry_get_userdata(entry)
+ );
+ else if ( listbox->HasClientUntypedData() )
+ event.SetClientData( gtk_tree_entry_get_userdata(entry) );
+
+ listbox->GetEventHandler()->ProcessEvent( event );
+
+ g_object_unref (entry);
+ return FALSE; //We handled it/did it manually