Grid rowselection not cleared with ClearRowSelect

How do I clear the selection of rows selected with smDisjunktRow?

Calling ClearRowSelect does nothing, the selection is still visible.

Please try

begin
   TMSFNCGrid1.BeginUpdate;
   TMSFNCGrid1.ClearRowSelect;
   TMSFNCGrid1.EndUpdate;
end;

Does not work for me, all lines stay connected.

Tested with default grid on the form and code:


procedure TForm1.Button1Click(Sender: TObject);
begin
   TMSFNCGrid1.BeginUpdate;
   TMSFNCGrid1.ClearRowSelect;
   TMSFNCGrid1.EndUpdate;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  TMSFNCGrid1.Options.Selection.Mode := smDisjunctRow;
end;

and this works.

If you keep seeing an issue with the latest version, provide sufficient details / sample source project to allow us to reproduce.

I sent a sample project

Thank you for a possible solution by email. It works, but I still believe that ClearRowSelect should clear any selection of whatever selection mode.


Another selection issue came up today, for which I dont want to open another thread because it fit in here.

When I select all rows in the grid (DisjunctRow mode) via code by for example using:
grid.SelectRows(1,grid.rowcount);
or looping:
for i:=1 to grid.RowCount-1 do grid.RowSelect:=true;

all rows as as expected selected. But when I then click with the mouse on one of the selected rows, it seems not to refresh the selection, means, rows which should not be selected anymore stay selected until the grid either refresh or I scroll the grid.
This does not happen when rows are selected with the mouse instead of code.

Hi,

We have traced and solved the issue you are experiencing with selecting the rows