Fix assert with setting current cell in wxGrid::Redimension()
Avoid calling wxGrid::SetCurrentCell(0, 0) when the grid has no columns or rows, as it doesn't have any cells then and doing this logically fails the precondition assert in GetColPos(). Also refactor all 6 different snippets calling SetCurrentCell() in Redimension() into a single function to simplify the code and make it more maintainable. Add a unit test verifying that this works as intended. Closes https://github.com/wxWidgets/wxWidgets/pull/1546
This commit is contained in:
committed by
Vadim Zeitlin
parent
41b444e011
commit
dda6aa6bdc
@@ -2309,6 +2309,10 @@ private:
|
||||
// common part of Clip{Horz,Vert}GridLines
|
||||
void DoClipGridLines(bool& var, bool clip);
|
||||
|
||||
// Redimension() helper: update m_currentCellCoords if necessary after a
|
||||
// grid size change
|
||||
void UpdateCurrentCellOnRedim();
|
||||
|
||||
// update the sorting indicator shown in the specified column (whose index
|
||||
// must be valid)
|
||||
//
|
||||
|
Reference in New Issue
Block a user