gajo wrote:
<snip>
You get the idea. And here comes the problem: I cannot get the CI's Left or
any other property, because I cannot access it. Like this:

procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin
with Sender do begin
  if (ClassType = TImage) then begin
    newX := X;
    newY := Y
  end else if (ClassType = TPeasants) then begin
    newX := X + Sender.Left;   // ERROR
    newY := Y + Sender.Top;   // ERROR
  end
end
end;

TObject is the root of the class hierarchy, and it doesn't know about the properties you're trying to access. You'll have to cast the object reference 'Sender' to an appropriate form - one that knows about the Tag and Position properties, or one that has ClientToScreen for example. Casting to TControl should work in all cases.


--
Corey Murtagh
The Electric Monk
"Quidquid latine dictum sit, altum viditur!"

---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to