• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 147
  • Last Modified:

How get 1 line from a memo by clicking

How can I take 1 line (show it in label1) out a memo by double clicking on it?

procedure TForm1.Memo1DblClick(Sender: TObject);
var X:integer;
begin
  X:=            ;
  label1.Caption:=Memo1.Lines[X];
end;

My problem is the 'X'
0
jurgentje
Asked:
jurgentje
  • 2
1 Solution
 
kretzschmarCommented:
too less points
0
 
EntrodusCommented:
procedure TForm1.Memo1DblClick(Sender: TObject);
var
  Y: Integer;
begin
  Y:= memo1.CaretPos.Y;
  label1.Caption:=Memo1.Lines[X];
end;
0
 
kretzschmarCommented:
an error entrodus

this
label1.Caption:=Memo1.Lines[X];

should be
label1.Caption:=Memo1.Lines[Y];

btw works only with version d4 and higher not with d3

meikl ;-)
0
 
jurgentjeAuthor Commented:
Thanks for the code, Entrodus ;)
I give a "Good" cause of the little mistake.
Correction: see kretzschmar's post.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now