When you're clicking quickly into your panel you're not only generating mouse down/up events, you're allso generating double-click events (WM_LBUTTONDBLCLK); Standard code for handling double clicks is very similar to that for handling mouse down events and it will capture the mouse if "csCaptureMouse in ControlStyle".
When you release the mouse button code in TControl handling this event will release the mouse capture so you'll be able to do something else with the mouse (like clicking the close button to close the app). Unfortunatelly the mouse-up message doesn't make it to TControl code because you redefined it's handler WITHOUT calling inherited so the mouse capture stays on. You've got a few options: 1) Give up on defining your own handlers and simply override MouseDown / MouseUp; Those methods are dynamic for a raison! 2) Handle ALL mouse messages to be safe. 3) Set ControlState := ControlState - [csCaptureMouse] so you don't need to care about mouse capture ever again. P.S: There's a BIG difference betwen TGraphicControl and TCustomPanel/TCustomControl. Stick with TCustomPanel/TCustomControl if unsure. Ken Phipps wrote: > I'm trying to create a simple component to draw rows/columns of > buttons. The first thing I'm trying to get done is the mouse event > handling. I was able to figure out how to catch the windows messages > and have them trigger published events from some examples I've found, > but I'm having a problem it. If you click very quickly in rapid > succession, the control seems to steal the mouse input for the entire > application. You can't even click on the form's close button as the > click gets taken. > > In a test project, I notice that in a listbox that displays the > events when they are fired, when it shows a MouseUp event firing > without a corresponding MouseDown, that's when the control will begin > to steal all mouse input from that point onward. You have to kill the > app at that point. I read a post through a Google search about > problems like this happening with TGraphicControl descendants, so I > tried changing it to a TCustomPanel, but the problem is still there. > > Can anyone tell me what is causing this and how I can fix it? > > Here's a stripped down version of the component code with only the > relevant parts: > > << stripped away >> _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

