From 84c989626dc91c358d9125b65b27872722333d10 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Tue, 9 Feb 2021 20:09:19 +0100 Subject: [PATCH] Make slowness of attribute lookups more apparent in grid sample Multiply the number of rows in the grid sample by a factor of 10. This demonstrates the slowness with attribute lookups better when using checkered (Ctrl+Shift+K) or coloured (Ctrl+Shift+L) cells, as filling the grid is slowed down by way more than a factor of 10. Scrolling also becomes less responsive the further away from the home cell the view is. As a result of increasing the row count also move the cells positioned near the end of the grid there again, and don't use fixed coords for them. --- samples/grid/griddemo.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index 364a30448a..7218e1c202 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -595,7 +595,7 @@ GridFrame::GridFrame() grid->GetTable()->SetAttrProvider(new CustomColumnHeadersProvider()); - grid->AppendRows(100); + grid->AppendRows(1000); grid->AppendCols(100); int ir = grid->GetNumberRows(); @@ -632,11 +632,14 @@ GridFrame::GridFrame() grid->SetCellValue( 0, 5, "Press\nCtrl+arrow\nto skip over\ncells" ); - grid->SetRowSize( 99, 4*grid->GetDefaultRowSize() ); - grid->SetCellValue(98, 98, "Test background colour setting"); - grid->SetCellBackgroundColour(98, 99, wxColour(255, 127, 127)); - grid->SetCellBackgroundColour(99, 98, wxColour(255, 127, 127)); - grid->SetCellValue( 99, 99, "Ctrl+End\nwill go to\nthis cell" ); + const int endRow = grid->GetNumberRows() - 1, + endCol = grid->GetNumberCols() - 1; + + grid->SetRowSize(endRow, 4 * grid->GetDefaultRowSize()); + grid->SetCellValue(endRow - 1, endCol - 1, "Test background colour setting"); + grid->SetCellBackgroundColour(endRow - 1, endCol, wxColour(255, 127, 127)); + grid->SetCellBackgroundColour(endRow, endCol - 1, wxColour(255, 127, 127)); + grid->SetCellValue(endRow, endCol, "Ctrl+End\nwill go to\nthis cell"); grid->SetCellValue( 1, 0, "This default cell will overflow into neighboring cells, but not if you turn overflow off."); grid->SetCellValue(2, 0, "This one always overflows");