Si utilizas la TRxDBGrid puedes utilizar el método SelectAll y UnselectAll para todas las filas, en mi versión ampliada de este grid, he agregado el código de InvertSelection que te paso aquí:
Código:
procedure TRxDBGrid.SelectAll;
var
ABookmark: TBookmark;
begin
if MultiSelect and DataLink.Active then begin
with Datalink.Dataset do begin
if (BOF and EOF) then Exit;
DisableControls;
try
ABookmark := GetBookmark;
try
First;
while not EOF do begin
SelectedRows.CurrentRowSelected := True;
Next;
end;
finally
try
GotoBookmark(ABookmark);
except
end;
FreeBookmark(ABookmark);
end;
finally
EnableControls;
end;
end;
end;
end;
procedure TRxDBGrid.UnselectAll;
begin
if MultiSelect then begin
SelectedRows.Clear;
FSelecting := False;
end;
end;
Código:
procedure TFSDBGrid.InvertSelection;
var
ABookmark: TBookmark;
begin
if MultiSelect and DataLink.Active then begin
with Datalink.Dataset do begin
if (BOF and EOF) then Exit;
DisableControls;
try
ABookmark := GetBookmark;
try
First;
while not EOF do begin
SelectedRows.CurrentRowSelected := not SelectedRows.CurrentRowSelected;
Next;
end;
finally
try
GotoBookmark(ABookmark);
except
end;
FreeBookmark(ABookmark);
end;
finally
EnableControls;
end;
end;
end;
end;