Fix editing items with custom renderers in wxGTK wxDataViewCtrl
Call FinishEditing() when the cell is done being edited instead of sending wxEVT_DATAVIEW_ITEM_EDITING_DONE event manually from wxGTK code. This fixes the bug with not being able to edit an item the second time if the editor was dismissed by GTK+ itself and not by our own code (which already did call FinishEditing()) as the old editor still remained alive because DestroyEditControl(), usually called from FinishEditing(), wasn't executed. It also removes code duplication and avoids the need to keep a global s_user_data pointer as the item currently being edited is already stored in wxDataViewRenderer anyhow.
This commit is contained in:
parent
7e37c6763f
commit
31a10d0355
@ -1742,20 +1742,11 @@ bool wxGtkDataViewModelNotifier::Cleared()
|
||||
// wxDataViewRenderer
|
||||
// ---------------------------------------------------------
|
||||
|
||||
static gpointer s_user_data = NULL;
|
||||
|
||||
static void
|
||||
wxgtk_cell_editable_editing_done( GtkCellEditable *WXUNUSED(editable),
|
||||
wxDataViewRenderer *wxrenderer )
|
||||
{
|
||||
wxDataViewColumn *column = wxrenderer->GetOwner();
|
||||
wxDataViewCtrl *dv = column->GetOwner();
|
||||
wxDataViewEvent event( wxEVT_DATAVIEW_ITEM_EDITING_DONE, dv->GetId() );
|
||||
event.SetDataViewColumn( column );
|
||||
event.SetModel( dv->GetModel() );
|
||||
wxDataViewItem item( s_user_data );
|
||||
event.SetItem( item );
|
||||
dv->HandleWindowEvent( event );
|
||||
wxrenderer->FinishEditing();
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1772,8 +1763,6 @@ wxgtk_renderer_editing_started( GtkCellRenderer *WXUNUSED(cell), GtkCellEditable
|
||||
|
||||
if (GTK_IS_CELL_EDITABLE(editable))
|
||||
{
|
||||
s_user_data = item.GetID();
|
||||
|
||||
g_signal_connect (editable, "editing_done",
|
||||
G_CALLBACK (wxgtk_cell_editable_editing_done),
|
||||
(gpointer) wxrenderer );
|
||||
|
Loading…
Reference in New Issue
Block a user