From 607e950899c4d3f021ca44a892ceb05893804902 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Mar 2014 16:53:46 +0000 Subject: [PATCH] Fix clicking on activatable toggle column in generic wxDataViewCtrl. Call PrepareForItem() after calling GetLineStart() as the latter calls PrepareForItem() for other items internally, undoing the effects of the first call. Closes #16132. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76217 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/datavgen.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 4ee1079801..add0d06098 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -4493,13 +4493,17 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) if ( IsCellEditableInMode(item, col, wxDATAVIEW_CELL_ACTIVATABLE) ) { // notify cell about click - cell->PrepareForItem(model, item, col->GetModelColumn()); wxRect cell_rect( xpos + itemOffset, GetLineStart( current ), col->GetWidth() - itemOffset, GetLineHeight( current ) ); + // Note that PrepareForItem() should be called after GetLineStart() + // call in cell_rect initialization above as GetLineStart() calls + // PrepareForItem() for other items from inside it. + cell->PrepareForItem(model, item, col->GetModelColumn()); + // Report position relative to the cell's custom area, i.e. // not the entire space as given by the control but the one // used by the renderer after calculation of alignment etc.