Previously the combobox was immediately dismissed when the mouse was used.
Fix this by copying the code from wxGridCellChoiceEditor to this class. This
is obviously not ideal and both classes should be refactored to avoid this in
the future but for now this at least fixes the user-visible problem.
Closes #13943.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71933
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
- Implement native tab art for wxAUI (Jens Lody and Teodor Petrov).
- Fix pasting large amounts of text (Bradley Hawkins).
- Show gstreamer errors if wxMediaCtrl fails to play file.
- Implement native tab art for wxAUI (Jens Lody and Teodor Petrov).
- Fix pasting large amounts of text (Bradley Hawkins).
- Show gstreamer errors if wxMediaCtrl fails to play file.
+- Fix wxGridCellEnumEditor mouse handling (Fulvio Senore).
wxASSERT_MSG(m_control,
wxT("The wxGridCellEnumEditor must be Created first!"));
wxASSERT_MSG(m_control,
wxT("The wxGridCellEnumEditor must be Created first!"));
+ wxGridCellEditorEvtHandler* evtHandler = NULL;
+ if (m_control)
+ evtHandler = wxDynamicCast(m_control->GetEventHandler(), wxGridCellEditorEvtHandler);
+
+ // Don't immediately end if we get a kill focus event within BeginEdit
+ if (evtHandler)
+ evtHandler->SetInSetFocus(true);
+
wxGridTableBase *table = grid->GetTable();
if ( table->CanGetValueAs(row, col, wxGRID_VALUE_NUMBER) )
wxGridTableBase *table = grid->GetTable();
if ( table->CanGetValueAs(row, col, wxGRID_VALUE_NUMBER) )
Combo()->SetSelection(m_index);
Combo()->SetFocus();
Combo()->SetSelection(m_index);
Combo()->SetFocus();
+#ifdef __WXOSX_COCOA__
+ // This is a work around for the combobox being simply dismissed when a
+ // choice is made in it under OS X. The bug is almost certainly due to a
+ // problem in focus events generation logic but it's not obvious to fix and
+ // for now this at least allows to use wxGrid.
+ Combo()->Popup();
+#endif
+
+ if (evtHandler)
+ {
+ // When dropping down the menu, a kill focus event
+ // happens after this point, so we can't reset the flag yet.
+#if !defined(__WXGTK20__)
+ evtHandler->SetInSetFocus(false);
+#endif
+ }
}
bool wxGridCellEnumEditor::EndEdit(int WXUNUSED(row),
}
bool wxGridCellEnumEditor::EndEdit(int WXUNUSED(row),