TIP: Click on subject to list as thread! ANSI
echo: delphi
to: BRYAN SMITH
from: FRANCOIS PIETTE
date: 1997-03-17 10:57:00
subject: Selective handling of mouse clicks

Salut Bryan Smith !
Dans un message de Bryan Smith dat‚ du 14 Mar 97  10:30:55 il ‚tait dit:
  BS> I need to handle mouse clicks in the following manner. First, examine
  BS> theclick's x and y coordinates to determine if they lie within a
  BS> (graphic)rectangle of interest. If they do, handle the click based on
  BS> the x,yvalues. If not, pass the click back to windows and let it
  BS> handle it, sincethe click must have been on a standard
  BS> control.Alternatively, I suppose, I could let windows first check to
  BS> see if theclick is on a control, and failing that it could pass it to
  BS> me to handle.Can somebody who has been there tell me how this is done,
  BS> please ?
You can use the SetCapture Windows API function to get all the mouse 
click captured by a single window. When you are done, you can 
ReleaseCapture to return to normal mouse events.
But if you must determines which control was clicked on, you'd better 
let windows do the job because it is fairly complex when windows are 
overlapping.
Most Delphi VCL have their own mouse click event. So there is no 
difficulty to determine if the click is related to the rectangle of 
interest provided this rectangle is a control. If there are other 
controls in this rectangel, you must handle the OnClick event for each 
of them (for example a TPanel with some TEdit). You can iterate thru 
all the controls in the panel and assign a single OnClick event 
handler wich will do the job.
Amiti‚s,
{-Francois Piette-}
francois.piette@ping.be
http://www.rtfm.be/fpiette
--- SvFido 1.32
---------------
* Origin: OverByte BBS (Embourg-Belgium) 32-4-3651395 VFC/V34+ (2:293/2202)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.