1 (edited by john 2021-02-10 16:35:39)

Topic: What is the script to show a record.

Hi everyone, can anyone tell me the script to show a record in a for, i know i can do it with a button
(show record) but just need to do it from a script.
This i want to do from a single click on a grid, as below.


procedure Address_TableGrid1_OnCellClick (Sender: TObject; ACol, ARow: Integer);
begin

?????????

end;



Many thanks

John

Re: What is the script to show a record.

Hi John,
Try it like this:
.
procedure Form1_TableGrid1_OnCellClick (Sender: TObject; ACol, ARow: Integer);
begin
  form2.ShowRecord('mytable',form1.tablegrid1.dbitemid);
end;
.
You could also just hide your showrecord button and then do it like this:
procedure Form1_TableGrid1_OnCellClick (Sender: TObject; ACol, ARow: Integer);
begin
  form1.button2.click;    //(where button2 = showrecord) 
end;
.
What you also need to consider when you go down the 'single click' route is how you want to handle deleting records from the grid.
Derek