Also:

You might want to have a look at TControl.ScreenToClient and TControl.ClientToScreen 
methods for translating positions (i.e. your mouse clicks) between different controls 
- that way you will be able to get the same relative coordinates regardless of which 
control your user is clicking on.

HTH,

Conor

-----Original Message-----
From: gajo [mailto:[EMAIL PROTECTED]

[snip]

Image1 covers the entire form. On it, the created TImages (I'll call them
CIs) are moving around in random directions, and the user tries to click on
them. When he misses (the Image1 is clicked), I get the X and Y position of
the mouse pointer and do some stuff. When he doesn't miss, then one of the
CIs need to do the same.
Now, since clicking on a CI will not give back the same coordinates as when
clicking on the Image1 in the same spot, I need to calculate the coordinates
so that

newX := CI.Left + X;
newY := CI.Top + Y;

newX and newY are global variables.

[snip]
---------------------------------------------------------------------------
    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