Fix dragging beyond the rightmost column in generic wxHeaderCtrl

Dragging a column header in a wxHeaderCtrl and dropping it past the
rightmost column resulted in a crash due to accessing a column with
invalid index.

Fix this and correctly move the column to the last position when this
happens instead.

This bug notably affected dragging columns in wxGrid.

Closes https://github.com/wxWidgets/wxWidgets/pull/972
This commit is contained in:
John Gehrig
2018-10-11 15:47:16 -04:00
committed by Vadim Zeitlin
parent 6e3f818da1
commit b07305234c
2 changed files with 34 additions and 4 deletions

View File

@@ -98,6 +98,10 @@ private:
// column 1 but close enough to the divider separating it from column 0)
unsigned int FindColumnAtPoint(int x, bool *onSeparator = NULL) const;
// return the result of FindColumnAtPoint() if it is a valid column,
// otherwise the index of the last (rightmost) displayed column
unsigned int FindColumnClosestToPoint(int xPhysical) const;
// return true if a drag resizing operation is currently in progress
bool IsResizing() const;