delphifiremonkeydelphi-xe8stringgrid

how to copy selected data from stringgrid


i couldn't find the way to copy selected cell data from a stringgrid, i want the selected data string to be copied to Edit box if possible.. many thanks in advance. im using delphi xe8, firemonkey.

what i tried so far..

Private
A : Array of TValue;
procedure TForm1.Grid1GetValue(Sender: TObject; const Col, Row: Integer; var        Value: TValue);
 begin
// Gets the value from a cell in the first column
if Col = 0 then
 Value := A[Row];

procedure TForm1.Button2Click(Sender: TObject);
begin
A[1] := Edit1.Text;
end;

Solution

  • //i spent hours just to figure it out,waste of TIME;//
    
    Procedure Formx.StringGrid1SellectCell(Sender: TObject; const ACol,Arow: integer;   var CanSellect: Boolean);
    Var
    Val: string;
    begin
    Val := StringGrid1.Cells[ACol, ARow];
    Edit1.Text:= Val;