Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Mouse up/down
Wed, Feb 8 2017 10:47 AMPermanent Link

Matthew Jones

I am trying to get a drag system working, and using MouseDown and MouseUp events. The mouse down works, and mouse up works if I keep it within the same embedded form. But if I move out of the current form and to another form (same type), the mouse up event is lost. I only get it when I click again for a new MouseDown and up again.

I wonder if this is some sort of mouse capture interfering. But that normally has the event go back to the original down location. Anyone know anything about this? Or possible changes about to be available?

--

Matthew Jones
Wed, Feb 8 2017 2:28 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I am trying to get a drag system working, and using MouseDown and MouseUp events. The mouse down works, and mouse up works if I keep it within the same embedded form. But if I move out of the current form and to another form (same type), the mouse up event is lost. I only get it when I click again for a new MouseDown and up again.

I wonder if this is some sort of mouse capture interfering. But that normally has the event go back to the original down location. Anyone know anything about this? Or possible changes about to be available? >>

You're using the wrong methods/events.  What you want are these TControl methods (protected):

        function DoCaptureStart(Button: Integer; ShiftKey, CtrlKey, AltKey: Boolean; X,Y: Integer): Boolean; virtual;
        procedure DoCapturing(X,Y: Integer); virtual;
        procedure DoCaptureEnd(X,Y: Integer); virtual;

Overriding these methods will allow you to capture the mouse events within the control so that you can handle dragging.  Check out the TCaptionBarControl control in the WebCtnrs unit for more information on how this is done.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Feb 10 2017 9:26 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> You're using the wrong methods/events.  What you want are these TControl methods (protected):
>
>          function DoCaptureStart(Button: Integer; ShiftKey, CtrlKey, AltKey: Boolean; X,Y: Integer): Boolean; virtual;
>          procedure DoCapturing(X,Y: Integer); virtual;
>          procedure DoCaptureEnd(X,Y: Integer); virtual;
>
> Overriding these methods will allow you to capture the mouse events within the control so that you can handle dragging.  Check out the TCaptionBarControl control in the WebCtnrs unit for more information on how this is done.

This has worked fine. It would be good to have a "what component is under the mouse" but that's not too hard to write (and given I knew where I was interested in, I can make it more optimal). Key is it is reliable, and effective. Thanks.

--

Matthew Jones
Image