2
In the form of DBGrid
, create a procedure
:
procedure DBGridClick(Sender: TObject);
Implement Procedure, doing whatever you want. Call the other form, etc:
procedure TForm1.DBGridClick(Sender: TObject);
var
frmDetalhes : TfrmDetalhes;
begin
frmDetalhes := TfrmDetalhes.Create(Application);
frmDetalhes.pID := dsCliente.DataSet.FieldByName('ID').AsInteger;
frmDetalhes.Show;
end;
To assign the event to DBGrid
, in the method create
of Form
, do:
DBGrid1.ControlStyle := DBGrid1.ControlStyle + [csClickEvents];
TForm(DBGrid1).OnClick := DBGridClick;
Here we enable the click
and we set the procedure
at the event.
there instead of executing the command
Show
execute theShowModal
, because, imagine that the guy click again on the grid, we would have a memory violation... +1 By Correct Answer!– Junior Moreira
@Correct Juniorate Observation! + 1
– Celso Marigo Jr