0
votes

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;
1
Can you show us what you have tried? Surely all you need to do is read text from the grid, and write text to the edit. Which part of this are you stuck with? - David Heffernan
i couldn't do anything, all codes are related to VCL !, im stuck with the codes and the copy process @David Heffernan - markkk
First of all, do you know how you set the text of an edit control? Did you look in the documentation? - David Heffernan
A:Array of TValue, i really dont have time to study this component, any help will be appreciated. @David Heffernan - markkk
there is nothing special, just a stringgrid with 2 columns filled with string !!. i want to select a cell from col2 and copy its data to Edit box, @Jerry Dodge - markkk

1 Answers

2
votes
//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;