Don't change the icon when editing wxDataViewIconText cells in generic version.
wxDataViewIconTextRenderer changed the icon to that of the last item drawn by it when editing a cell. Fix this by getting the original icon directly from the model instead of from the last item. Closes #14187. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71105 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1187,7 +1187,17 @@ bool wxDataViewIconTextRenderer::GetValueFromEditorCtrl( wxWindow *editor, wxVar
|
|||||||
{
|
{
|
||||||
wxTextCtrl *text = (wxTextCtrl*) editor;
|
wxTextCtrl *text = (wxTextCtrl*) editor;
|
||||||
|
|
||||||
wxDataViewIconText iconText(text->GetValue(), m_value.GetIcon());
|
// The icon can't be edited so get its old value and reuse it.
|
||||||
|
wxVariant valueOld;
|
||||||
|
wxDataViewColumn* const col = GetOwner();
|
||||||
|
GetView()->GetModel()->GetValue(valueOld, m_item, col->GetModelColumn());
|
||||||
|
|
||||||
|
wxDataViewIconText iconText;
|
||||||
|
iconText << valueOld;
|
||||||
|
|
||||||
|
// But replace the text with the value entered by user.
|
||||||
|
iconText.SetText(text->GetValue());
|
||||||
|
|
||||||
value << iconText;
|
value << iconText;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user