Try casting Source.  TObject doesn't have a top or left, but a TLabel
does.

 

Jeremy

 

 

From: advanced_delphi@yahoogroups.com
[mailto:advanced_del...@yahoogroups.com] On Behalf Of Niel
Sent: Monday, May 24, 2010 12:37 AM
To: advanced_delphi@yahoogroups.com
Subject: [advanced_delphi] Drag Drop Labels

 

  

I have some labels that I want to reposition on a chart with Drag Drop.
I chose dmAutomatic for the labels. 

As shown below, the code won't compile. 
Delphi says that Left and Top are Undeclared for source. 
When I replace source with a specific label name the program 
runs and the specific label will reposition correctly. 

What should I replace source with in the code below to make 
the program work in a generalized way?

procedure TForm1.Chart1DragDrop(Sender, Source: TObject; X, Y: Integer);
begin
source.left := x;
source.top := y;
end;

procedure TForm1.Chart1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
accept := true;
end;



Reply via email to