I didn't notice the question had already been answered several times already until I hit "send". Sorry!!
Robert On Tue, May 25, 2010 at 2:21 PM, Robert Jenkins <uss...@gmail.com> wrote: > I think you might need to do something like > > If (Source is TControl) Then > With (Source As TControl) Do > Begin > Left := x; > Top := y; > End; > > > I think TControl is where Top and Left properties are first introduced for > a TLabel. You could also do > > If (Source Is TLabel) Then > With (Source As TLabel) Do > Begin > Left := x; > Top := y; > End; > > You could also type cast the source to a TLabel by doing > > TLabel(Source).Left := x; > TLabel(Source).Top := y; > > > Robert > > > On Mon, May 24, 2010 at 2:36 AM, Niel <ralphs...@att.net> wrote: > >> >> >> 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; >> >> >> > >