0

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;
markkk
  • 31
  • 2
  • 7
  • 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 Aug 22 '15 at 17:16
  • i couldn't do anything, all codes are related to VCL !, im stuck with the codes and the copy process @David Heffernan – markkk Aug 22 '15 at 17:22
  • First of all, do you know how you set the text of an edit control? Did you look in the documentation? – David Heffernan Aug 22 '15 at 17:24
  • well, im still a beginner, what documentation?there is nothing at docwiki about stringgrids!@David Heffernan – markkk Aug 22 '15 at 17:28
  • There certainly is documentation for these controls. Search for docwiki fmx TStringGrid delphi. – David Heffernan Aug 22 '15 at 17:40
  • If you want to use Firemonkey, you should seriously consider upgrading to one of the later versions, such as XE8. XE2 was the very first version introducing Firemonkey, and it was extremely primitive back then. – Jerry Dodge Aug 22 '15 at 17:57
  • i mentioned that i use XE8 @Jerry Dodge – markkk Aug 22 '15 at 18:15
  • @markkk Oh, I saw the `delphi-xe2` tag, which appears to be corrected now. – Jerry Dodge Aug 22 '15 at 18:20
  • I've tried something, can u insight me plz now.@David Heffernan – markkk Aug 22 '15 at 18:38
  • Your code makes no sense to me. We don't know what `A` is. I recommend that you read the documentation. Slow down, step back, and try harder. – David Heffernan Aug 22 '15 at 19:10
  • 1
    A:Array of TValue, i really dont have time to study this component, any help will be appreciated. @David Heffernan – markkk Aug 22 '15 at 19:32
  • You don't have time? In that case neither do I. – David Heffernan Aug 22 '15 at 19:35
  • If you can't find the time to present enough code for us to debug for you, then why should we take the time to guess what *might* be wrong in the rest of the code which we cannot see? Your code is incomplete and uncompilable. – Jerry Dodge Aug 22 '15 at 19:59
  • 1
    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 Aug 22 '15 at 21:50

1 Answers1

2
//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;
markkk
  • 31
  • 2
  • 7