Delphi and Kylix

Moderators: pritaeas
Number of threads: 7264
Number of posts: 19073

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Working with Canvas Posted by tj29 on 24 Dec 2003 at 11:49 AM
I wrote a small application that draws 2 rectangels on a canvas. what i would like to know how to do is to be able to click on either rectangel and display the x and y using the showmessage. Really all i need to know is how to double click on an image drawn on a canvas for example the two rectangels i did. i would really appreciate that. thanks.
Report
Re: Working with Canvas Posted by zibadian on 25 Dec 2003 at 2:17 AM
: I wrote a small application that draws 2 rectangels on a canvas. what i would like to know how to do is to be able to click on either rectangel and display the x and y using the showmessage. Really all i need to know is how to double click on an image drawn on a canvas for example the two rectangels i did. i would really appreciate that. thanks.
:
That entirely depends on the canvas of which control you're talking about. Most controls have an OnClick() and/or OnDblClick() event associated with it. In that event you can use the Mouse.CursorPos to get the X and Y of the click.
If you have an unassociated canvas, then you need to trap the WM_MOUSE messages and calculate the position relative to your canvas.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.