Windows 10 x64
TMS Component Pack 8.4.0.0
Delphi Berlin 10.1 update 1
Getting the checkbox state of unfiltered rows seems to work as expected. The problem is when a user applies filters: The user should be able to filter all rows and check all left after filtering by one click. Using some event handler I need to find all currently checked and visible rows and do something with those. Checking and unchecking all rows or only some of those individually works fine as well, I can even properly iterate only the visible/filtered rows. Only getting the checkbox state doesn't work properly, most or even all checked rows are returned to be unchecked.
The following code can be used to demonstrate the problem, simply input some number in the filter edit of the first column, without changing conditions or else. Add some breakpoints in the event handler, especially the lines with "insert" and "size" are interesting, because one can see which row indexes are believed to be checked and which are not. Using "checkAll" in 0:0 or individually checking/unchecking rows doesn't change a thing.
When the filter is removed getting the checkbox state works even if the checkbox state is not changed anymore. So load the app, filter the first column, check all, recognize most of the rows to be unchecked, remove the filter, all rows are visible with their former checkbox state, recognize or checked rows are properly recognized now. Apply the filter again and not all rows are properly recognized anymore.
Is this reproducible for, can you fix it and maybe even provide some workaround until the next release? Thanks!
AdvStringGrid3->ColCount = 5;
AdvStringGrid3->RowCount = 10;
AdvStringGrid3->FixedCols = 1;
AdvStringGrid3->FixedRows = 1;
AdvStringGrid3->FilterEdit->Enabled = true;
AdvStringGrid3->MouseActions->CheckAllCheck = true;
AdvStringGrid3->AddCheckBoxColumn(0);
//AdvStringGrid3->MouseActions->HotmailRowSelect = true;
AdvStringGrid3->Options << goEditing;
AdvStringGrid3->RandomFill(false);
void __fastcall TForm1::GetCheckedClick(TObject *Sender)
{
TAdvStringGrid* grid(this->AdvStringGrid3);
size_t checkBoxColIdx(0);
std::set<size_t> checkedRows;
for (int rowIdx = grid->FixedRows; rowIdx < grid->RowCount; ++rowIdx)
{
bool checked = false;
if (!grid->GetCheckBoxState(checkBoxColIdx, rowIdx, checked) ||
!checked)
{
continue;
}
checkedRows.insert(rowIdx);
}
size_t checkedRowsCnt = checkedRows.size();
}