In a TTMXFMXLiveGrid I've use this code to programmatically select a Row in the grid:
procedure TGetLinsDlnSlsController.OnFixedCellClick(Sender: TObject; ACol, ARow: Integer);
begin
if ARow >= FView.LiveGrid.FixedRows then begin
FView.BeginUpdate;
try
case ACol of
DELETE:begin
FView.LiveGrid.SelectRows(ARow, ARow);
FModel.ExcludeCurrent;
FView.LiveGrid.UpdateGridCells;
FView.ShowMessage('Elemento excludido de la selección');
end;
CHECKED:begin
FView.LiveGrid.SelectRows(ARow, ARow);
if FModel.SwitchChecked then begin
FView.LiveGrid.AddBitmap(CHECKED, ARow, 'BitmapCHECKED');
FView.ShowMessage('Elemento seleccionado');
end
else begin
FView.LiveGrid.AddBitmap(CHECKED, ARow, 'BitmapUNCHECKED');
FView.ShowMessage('Elemento no seleccionado');
end;
FView.LiveGrid.UpdateGridCells;
end;
end;
finally
FView.EndUpdate;
end;
end;
end;
You can see how it works in this link: https://vine.co/v/iEBTienrDdz
Now I'm using the same code in a TTMSFMXGrid and the result is this: https://vine.co/v/iEBT2dxIZ0h
Next the code for this:
procedure TOrdersMnfController.OnCellBitmapClick(Sender: TObject; ACol, ARow: Integer; Cell: TFmxObject);
begin
if ARow >= FView.GridLines.FixedRows then begin
case ACol of
BTN_DELETE:begin
FView.GridLines.SelectRows(ARow, ARow);
//FModel.ExcludeCurrent;
//FView.LiveGrid.UpdateGridCells;
//FView.ShowMessage('Elemento excludido de la selección');
end;
BTN_CLONE:begin
FView.GridLines.SelectRows(ARow, ARow);
{if FModel.SwitchChecked then begin
FView.LiveGrid.AddBitmap(CHECKED, ARow, 'BitmapCHECKED');
FView.ShowMessage('Elemento seleccionado');
end
else begin
FView.LiveGrid.AddBitmap(CHECKED, ARow, 'BitmapUNCHECKED');
FView.ShowMessage('Elemento no seleccionado');
end;
FView.LiveGrid.UpdateGridCells;}
end;
BTN_EDIT:begin
FView.GridLines.SelectRows(ARow, ARow);
{if FModel.SwitchChecked then begin
FView.LiveGrid.AddBitmap(CHECKED, ARow, 'BitmapCHECKED');
FView.ShowMessage('Elemento seleccionado');
end
else begin
FView.LiveGrid.AddBitmap(CHECKED, ARow, 'BitmapUNCHECKED');
FView.ShowMessage('Elemento no seleccionado');
end;
FView.LiveGrid.UpdateGridCells;}
end;
end;
end;
end;