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.