Fix editing cells without values in wxGTK wxDataViewCtrl
Do not hide cells without values at GTK level, as this makes them not only appear as blank (which is fine), but also prevents them from being edited, which is not, as the user should be able to enter values into the previously empty cells. This fixes regression introduced back in74e1c444fa
(Don't show bogus value when there are none in wxGTK wxDVC neither, 2021-12-01). Note that this also undoes the changes of8aefedcb45
(Remove duplicated HasValue() call from wxGTK wxDataViewCtrl code, 2022-05-08) and HasValue() is called twice again now, but this is less of a problem than wrong behaviour fixed by this commit and we can address it later, e.g. by passing the cell value to PrepareForItem() instead of retrieving it inside it, if it turns out to be really worth it. See #23523. (cherry picked from commit 821c2a07fe2b29c283e11f25b184e3d6d9a17013)
This commit is contained in:
parent
285c49bf8a
commit
d57fe1e562
@ -258,6 +258,7 @@ wxGTK:
|
||||
- Dramatically optimize adding many items to wxChoice (Ian McInerney, #23443).
|
||||
- Improve document wxGLCanvas::CreateSurface() (Dan Gudmundsson, #23366).
|
||||
- Fix loading WebKit2 extension when using wxWebView (Scott Talbert, #23497).
|
||||
- Fix editing cells without values in wxDataViewCtrl (#23523).
|
||||
|
||||
wxMSW:
|
||||
|
||||
|
@ -3224,10 +3224,18 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
|
||||
|
||||
wxDataViewModel *wx_model = tree_model->internal->GetDataViewModel();
|
||||
|
||||
cell->GtkSetCurrentItem(item);
|
||||
|
||||
// Cells without values shouldn't be rendered at all.
|
||||
const bool visible = cell->PrepareForItem(wx_model, item, column);
|
||||
const bool visible = wx_model->HasValue(item, column);
|
||||
if ( visible )
|
||||
{
|
||||
cell->GtkSetCurrentItem(item);
|
||||
|
||||
// Ignore the return value of PrepareForItem() here, if it returns
|
||||
// false because GetValue() didn't return anything, we still want to
|
||||
// keep this cell visible, as otherwise it wouldn't be possible to edit
|
||||
// it neither, and we do want to allow editing empty cells.
|
||||
cell->PrepareForItem(wx_model, item, column);
|
||||
}
|
||||
|
||||
wxGtkValue gvalue( G_TYPE_BOOLEAN );
|
||||
g_value_set_boolean( gvalue, visible );
|
||||
|
Loading…
Reference in New Issue
Block a user