From f68c88b8d2850d233855c6417f60cc980e861608 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 12 Oct 2015 01:13:56 +0200 Subject: [PATCH] Fix showing cells without values in wxDataViewCtrl Fix regression introduced in a49567109ab36421dbd68a4c86ef5ecf3d364ab5: cells without value, i.e. for which the wxVariant returned from GetValue() is not set at all, should appear as empty, not reuse the last value used by this renderer. --- src/common/datavcmn.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp index 770022875e..d9e3d93a69 100644 --- a/src/common/datavcmn.cpp +++ b/src/common/datavcmn.cpp @@ -813,12 +813,14 @@ wxDataViewRendererBase::PrepareForItem(const wxDataViewModel *model, const wxDataViewItem& item, unsigned column) { - // Now check if we have a value and remember it if we do. + // Now check if we have a value and remember it for rendering it later. + // Notice that we do it even if it's null, as the cell should be empty then + // and not show the last used value. const wxVariant& value = CheckedGetValue(model, item, column); + SetValue(value); + if ( !value.IsNull() ) { - SetValue(value); - // Also set up the attributes for this item if it's not empty. wxDataViewItemAttr attr; model->GetAttr(item, column, attr);