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
How to detect the double click by mouse? Posted by earth_walker on 29 Jul 2003 at 7:24 AM
Hi! Delphi forms can trap the events such as OnClick, OnMouseDown, OnMouseUp, but nothing is related to double click directly. Is it possible to trap the double click? Shall I use some routine related to time?
Thank you!
Report
Re: How to detect the double click by mouse? Posted by Perran on 29 Jul 2003 at 8:09 AM
: Hi! Delphi forms can trap the events such as OnClick, OnMouseDown, OnMouseUp, but nothing is related to double click directly. Is it possible to trap the double click? Shall I use some routine related to time?
: Thank you!
:
Sure. A form has an OnDblClick message that you can trap. In fact, most of the widgets in Delphi have it.
Report
Re: How to detect the double click by mouse? Posted by earth_walker on 29 Jul 2003 at 10:12 AM
Thank you!
But this function doesn't have X,Y coordinates as parameters. If I only want to detect the double click to certain area, what shall I do?

Report
Re: How to detect the double click by mouse? Posted by Perran on 29 Jul 2003 at 10:57 AM
: Thank you!
: But this function doesn't have X,Y coordinates as parameters. If I only want to detect the double click to certain area, what shall I do?
:
:
Do you mean some arbitrary X,Y position within the form or is the mouse expected to be over a label or picture? If the latter, that's easier, just trap the OnDblClick message of the picture or label. If you're just out in the client area of the form, look up the wm_NCHitTest or cm_NCHitTest messages in the Windoze API help that comes with Delphi. Those return screen coordinates, so you'll have to convert to form coordinates with the ScreenToClient API function. It's much easier to use a label or picture. - HTH
Report
Re: How to detect the double click by mouse? Posted by zibadian on 29 Jul 2003 at 11:38 AM
: : Thank you!
: : But this function doesn't have X,Y coordinates as parameters. If I only want to detect the double click to certain area, what shall I do?
: :
: :
: Do you mean some arbitrary X,Y position within the form or is the mouse expected to be over a label or picture? If the latter, that's easier, just trap the OnDblClick message of the picture or label. If you're just out in the client area of the form, look up the wm_NCHitTest or cm_NCHitTest messages in the Windoze API help that comes with Delphi. Those return screen coordinates, so you'll have to convert to form coordinates with the ScreenToClient API function. It's much easier to use a label or picture. - HTH
:
You could also try to trap the WM_LBUTTONDBLCLK message. This could also be used to respond to right double clicks, or shift/control double clicks. The message also contains the screen coordinates.
Report
Re: How to detect the double click by mouse? Posted by earth_walker on 29 Jul 2003 at 12:30 PM
Thank you!



 

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.