[Lazarus] Purpose of MouseCapture?

Hans-Peter Diettrich DrDiettrich1 at aol.com
Tue Dec 21 13:17:58 CET 2010

What's the purpose of setting the mouse capture in the LCL?

It seems okay to let the user capture the mouse, and also the
dragmanager, but any other attempt to capture mouse messages looks not
logical to me. In the IDE it forces the DragManager to abort dragging,
and only bogus can happen in other cases, when mouse messages are not
delivered to the control under the mouse.

With the (new?) csCaptureMouse control state flag the mouse is captured
on every mouse event, with the beforementioned effect that the
DragManager stops working properly. This flag seems to be used in detail
inside the IDE.

I'd suggest to redesign the message handling in so far, that mouse and
key messages are sent immediately to an active DragManager, before any
other attempt to dispatch the messages to a different target. This will
eliminate any chance to break a drag operation in other than the
designed ways. Else the application (in detail the IDE) can enter an
inconsistent state, and the new (very buggy) drag window on Win32
(Vista...) cas work without adding code for forwarding all messages to
the DragManager.


More information about the Lazarus mailing list