diff --git a/docs/changes.txt b/docs/changes.txt index 50a33da7c8..e01c1c7524 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -650,6 +650,7 @@ wxMSW: - Disable the use of new style wxDirDialog under Vista to work around a bug in its implementation under this system (jtrauntvein). - Fix wxExecute() keeping open too many thread handles for too long (dannchr). +- Fix clicking on togglable columns in wxDataViewCtrl (Laurent Poujoulat). - Fix expander in non left-most position in wxDataViewCtrl (Laurent Poujoulat). wxOSX: diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 2f14e6d964..338454e5de 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -4398,13 +4398,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.