In TAdvStringGrid, When I Click Cells[0,0]
then uncheckAll behavior doing well
but checkAll is not.
Properties:
CheckAllCheck,
DisjunctRowSelect,
DisjunctRowSelectNoCtrl,
HotmailRowSelect,
RowSelect
are True in MouseActions.
goRangeSelect,
goRowSelect
are True in Options.
and OnRowDisjunctSelect has some codes:
begin
Allow := (sgd_1.Cells[1, ARow] = '');
end;
Tested with a default grid on the form and the code:
procedure TForm1.AdvStringGrid1RowDisjunctSelect(Sender: TObject; ARow: Integer;
AState: Boolean; var Allow: Boolean);
begin
Allow := (advstringgrid1.Cells[1, ARow] = '');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
advstringgrid1.MouseActions.CheckAllCheck := true;
advstringgrid1.MouseActions.DisjunctRowSelect := true;
advstringgrid1.MouseActions.DisjunctRowSelectNoCtrl := true;
advstringgrid1.MouseActions.HotmailRowSelect := true;
advstringgrid1.MouseActions.RowSelect := true;
advstringgrid1.Options := advstringgrid1.Options + [goRowSelect, goRangeSelect];
end;
and this cannot be reproduced.
OK! I Found It.
The Grid has Column Headers
and The First Event ARow has 0.
Cells[1,0] is not empty,
so The RowDisjunctSelect Event by CheckAllCheck is stoped after first event processing.
Thank you.
But Why uncheckAll is well doing?
It was not stopped.
The var Allow means what?
Cannot be reproduced.
Test code for a default grid:
procedure TForm1.AdvStringGrid1RowDisjunctSelect(Sender: TObject; ARow: Integer;
AState: Boolean; var Allow: Boolean);
begin
Allow := (advstringgrid1.Cells[1, ARow] = '');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
advstringgrid1.MouseActions.CheckAllCheck := true;
advstringgrid1.MouseActions.DisjunctRowSelect := true;
advstringgrid1.MouseActions.DisjunctRowSelectNoCtrl := true;
advstringgrid1.MouseActions.HotmailRowSelect := true;
advstringgrid1.MouseActions.RowSelect := true;
advstringgrid1.Navigation.MoveRowOnSort := true;
advstringgrid1.Options := advstringgrid1.Options + [goRowSelect, goRangeSelect];
advstringgrid1.RowSelect[4] := true;
advstringgrid1.RowSelect[5] := true;
advstringgrid1.RandomFill(false);
advstringgrid1.Cells[1,5] := '';
advstringgrid1.SortSettings.Show := true;
advstringgrid1.SortSettings.IndexShow := true;
end;
I can select/unselect row 5 and not unselect row 4.