[Lazarus] Purpose of MouseCapture?

Hans-Peter Diettrich DrDiettrich1 at aol.com
Mon Jan 10 04:32:05 CET 2011


Paul Ishenin schrieb:

>> The mouse is a shared resource, managed by the OS. I doubt that the
>> mouse capture can be stolen by other processes. I.e. the owner of the
>> mouse capture must release the capture, at some time (usually when the
>> mouse button is released).
> No, mouse capture can be stolen by any process.

I doubt that, but not every OS is perfect ;-)

At least the OS must notify the application that it lost mouse capture - 
this may be the only capture event that has to be handled by the 
DragManager.


>>> DragManager must handle the CaptureChanged event in order to 
>>> understand that capture it has was requested by other control and 
>>> therefore it must stop the drag operation.
>>
>> NACK. The LCL components implement some weird behaviour, that can result
>> in many changes of the mouse capture at the begin of a drag operation.
>> These nearly unpredictable changes often cause the DragManager to stop
>> dragging, in the current implementation. Once a control is dragged, 
>> there is no reason why the mouse capture should change until the end 
>> of the operation. When a control decides that dragging should stop, it 
>> should call DragManager.DragStop, everything else is insane.
> As result you will get a situation when application thinks that it 
> dragges something but capture is not owned by the drag manager so mouse 
> events are not tracked by it.

This cannot happen when the dragging condition is managed properly by 
the DragManager. Even if something goes really wrong, dragging stops at 
the next release of the mouse button, dispatched to the DragManager.

DoDi





More information about the Lazarus mailing list