Hi Neil,

You should probably be casting Source to a TLabel (or equivalent). I don't have 
a copy of Delphi on me but your code should look something like this:

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

Regards,
Cord

StaffPlan Ltd
http://www.staffplan.co.uk/

-----Original Message-----
From: advanced_delphi@yahoogroups.com [mailto:advanced_del...@yahoogroups.com] 
On Behalf Of Niel ralphspud-at-att.net |Advanced Delphi/Example Allow|
Sent: 24 May 2010 08:37
To: Cord Schneider; 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;



------------------------------------

Yahoo! Groups Links




StaffPlan Limited is an Advanced Computer Software company registered in 
England and Wales with company number 4344605.Registered Address: Unit 4, 
Eurogate Business Park, Ashford, Kent. TN24 8SB. VAT Registration Number: 748 
2060 34

This email, its contents and any files transmitted with it are intended solely 
for the addressee(s) and may be legally privileged and/or confidential. Access 
by any other party is unauthorised without the express written permission of 
the sender. If you have received this email in error you may not copy or use 
the contents, attachments or information in any way but please destroy it and 
contact the sender via email return.
Internet communications are not secure unless protected using strong 
cryptography. This email has been prepared using information believed by the 
author to be reliable and accurate, but StaffPlan Ltd. make no warranty as to 
accuracy or completeness. In particular StaffPlan Ltd. does not accept 
responsibility for changes made to this email after it was sent.
The contents of any attachment to this email may contain software viruses, 
which could damage your own computer system. While StaffPlan Ltd. has taken 
every reasonable precaution to minimise this risk, we cannot accept liability 
for any damage, which you sustain as a result of software viruses. You should 
carry out your own virus checks before opening the attachment.
Any opinions expressed in this document are those of the author and do not 
necessarily reflect the opinions of StaffPlan Ltd. or its affiliates.

Reply via email to