diff --git a/src/generic/gridsel.cpp b/src/generic/gridsel.cpp index b336bb4df0..81ee2a4641 100644 --- a/src/generic/gridsel.cpp +++ b/src/generic/gridsel.cpp @@ -746,10 +746,6 @@ wxGridCellCoordsArray wxGridSelection::GetCellSelection() const wxGridCellCoordsArray wxGridSelection::GetBlockSelectionTopLeft() const { - // return blocks only in wxGridSelectCells selection mode - if ( m_selectionMode != wxGrid::wxGridSelectCells ) - return wxGridCellCoordsArray(); - wxGridCellCoordsArray coords; const size_t count = m_selection.size(); coords.reserve(count); @@ -762,9 +758,6 @@ wxGridCellCoordsArray wxGridSelection::GetBlockSelectionTopLeft() const wxGridCellCoordsArray wxGridSelection::GetBlockSelectionBottomRight() const { - if ( m_selectionMode != wxGrid::wxGridSelectCells ) - return wxGridCellCoordsArray(); - wxGridCellCoordsArray coords; const size_t count = m_selection.size(); coords.reserve(count); diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index cd0fba8f50..934586b657 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -1163,6 +1163,16 @@ TEST_CASE_METHOD(GridTestCase, "Grid::SelectionMode", "[grid]") CHECK( m_grid->IsInSelection(5, 1) ); CHECK( !m_grid->IsInSelection(3, 1) ); + // Check that top left/bottom right selection functions still work in row + // selection mode. + wxGridCellCoordsArray arr = m_grid->GetSelectionBlockTopLeft(); + REQUIRE( arr.size() == 1 ); + CHECK( arr[0] == wxGridCellCoords(5, 0) ); + + arr = m_grid->GetSelectionBlockBottomRight(); + REQUIRE( arr.size() == 1 ); + CHECK( arr[0] == wxGridCellCoords(5, 1) ); + //Test row selection be selecting a single cell and checking the whole //row is selected m_grid->ClearSelection();