From: Vadim Zeitlin Date: Sun, 29 Jun 2008 00:19:44 +0000 (+0000) Subject: don't call SetInsertionPointToEnd() on read-only combobox in wxGridCellChoiceEditor... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b64845917a8aa2e6b6186ba6bd291debc2afc195 don't call SetInsertionPointToEnd() on read-only combobox in wxGridCellChoiceEditor::Reset() neither (this had been already fixed for StartEdit() before) (#8843) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54413 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 27027a2252..6590754456 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -1598,19 +1598,7 @@ void wxGridCellChoiceEditor::BeginEdit(int row, int col, wxGrid* grid) m_startValue = grid->GetTable()->GetValue(row, col); - if (m_allowOthers) - { - Combo()->SetValue(m_startValue); - Combo()->SetInsertionPointEnd(); - } - else // the combobox is read-only - { - // find the right position, or default to the first if not found - int pos = Combo()->FindString(m_startValue); - if (pos == wxNOT_FOUND) - pos = 0; - Combo()->SetSelection(pos); - } + Reset(); // this updates combo box to correspond to m_startValue Combo()->SetFocus(); @@ -1638,8 +1626,19 @@ bool wxGridCellChoiceEditor::EndEdit(int row, int col, void wxGridCellChoiceEditor::Reset() { - Combo()->SetValue(m_startValue); - Combo()->SetInsertionPointEnd(); + if (m_allowOthers) + { + Combo()->SetValue(m_startValue); + Combo()->SetInsertionPointEnd(); + } + else // the combobox is read-only + { + // find the right position, or default to the first if not found + int pos = Combo()->FindString(m_startValue); + if (pos == wxNOT_FOUND) + pos = 0; + Combo()->SetSelection(pos); + } } void wxGridCellChoiceEditor::SetParameters(const wxString& params)