How to get the text on filtered and checked row on TAdvStringgrid/TAdvColumnGrid.
My execution results:
Delphi 10.2, Open the the Demo -> AdvStringGrid -> aeg4 -> Asgdemo.dproj.
On the Filter tab. Add the 2 buttons, Button5 and Button6. Add the following code.
Then compile it.
And...
Select '>4 & <12' , Click Button4, Click Button5.
Then below is the message:
The results I want:
AdvStringGrid4.RowCount=15
[1]Audi
[5]BMW
[10]Honda
[22]TVR
Best regards.
----Add code----
procedure TDemo.Button5Click(Sender: TObject);
var
i : integer;
state: boolean;
s : string;
begin
s := 'AdvStringGrid4.RowCount=' + IntToStr(AdvStringGrid4.RowCount) + #13#10;
for I := 1 to AdvStringGrid4.RowCount - 1 do
if AdvStringGrid4.GetCheckBoxState(1,i,state) then
if state then s := s + '['+IntToStr(i)+']'+AdvStringGrid4.Cells[0,I] + ' '+AdvStringGrid4.Cells[1,I] + #13#10;
ShowMessage(s);
end;
procedure TDemo.Button6Click(Sender: TObject);
begin
if radiogroup1.itemindex = 0 then
AdvStringGrid1.SortSettings.Direction := sdAscending
else
AdvStringGrid1.SortSettings.Direction := sdDescending;
AdvStringGrid1.SortSettings.Column := 1;
AdvStringGrid1.QSort;
end;