TMSFMXGrid SelectRows/SelectColumns

Hi Pieter


I'm trying to get the column and row selection to be Excel-like - i.e. by clicking on the header row and using the FixedCellClick event. However, SelectRows/SelectColumns don't seem to be working. E.g. SelectColumns only ever selects the first cell:

procedure TForm2.TMSFMXGrid1FixedCellClick(Sender: TObject; ACol,
  ARow: Integer);
begin
  TMSFMXGrid1.SelectColumns(ACol, ACol); <---- Only one cell selected
  TMSFMXGrid1.BeginUpdate;
  TMSFMXGrid1.EndUpdate;
end;

Kind regards, Bob


Hi, 


You can use the following code to accomplish this:

  TMSFMXGrid1.SelectionMode := smCellRange;
  TMSFMXGrid1.SelectCell(Cell(Acol, 0), [], False);
  TMSFMXGrid1.SelectCell(Cell(Acol, TMSFMXGrid1.RowCount -1), [ssShift], False);

Kind Regards, 
Pïeter