From cdacccaee86586cca3fa15f51eb572db2c1024c9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 5 Apr 2012 18:40:23 +0000 Subject: [PATCH] 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 --- src/generic/datavgen.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 716d4b9bf9..e1e1e425db 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -1187,7 +1187,17 @@ bool wxDataViewIconTextRenderer::GetValueFromEditorCtrl( wxWindow *editor, wxVar { 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; return true; } -- 2.45.2