Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Mouse Capture
Wed, Dec 18 2013 9:49 AMPermanent Link

Matthew Jones

Normally, when a user clicks on a component and starts to drag, you would "capture"
the mouse input so that you can find out when the user releases the mouse button,
even if away from the initial control. Is there a way to do this in EWB? I see
mention of mouse capture in 1.02, but can't find anything about how to do this.
Clues? Is it even possible?

/Matthew Jones/
Thu, Dec 19 2013 2:40 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Normally, when a user clicks on a component and starts to drag, you would
"capture" the mouse input so that you can find out when the user releases
the mouse button, even if away from the initial control. Is there a way to
do this in EWB? I see mention of mouse capture in 1.02, but can't find
anything about how to do this. Clues? Is it even possible? >>

There's two things here:

1) If you just want to drag a control, then look at the TControl.BeginDrag
method (protected, but you can promote it).  That will kick the whole
process off, and the event manager will handle everything, including making
sure that it doesn't leave the boundaries of the parent control.

2) If you really need to capture the mouse for reasons other than dragging
the control, then you can use this code:

Start: EventManager.CaptureMouse(MyControl);
End: EventManager.EndCapture;

The grid uses this for sizing the columns - it captures the mouse for the
entire grid so that if you move the mouse outside of the bounds of the grid,
it still "has" the mouse.

If you have any other questions, please let me know.

Tim Young
Elevate Software
www.elevatesoft.com


Fri, Dec 20 2013 5:00 AMPermanent Link

Matthew Jones

Thank you. I don't want to use "built in" drag as it probably isn't quite what I
want (on one, it is a horizontal slider only). Capturing the mouse will work to
improve it though (I had added the OnLeave though, but it isn't so good).

/Matthew Jones/
Fri, Dec 20 2013 5:49 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I had added the OnLeave though, but it isn't so good >>

??? Smile

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Dec 20 2013 8:47 AMPermanent Link

Matthew Jones

> << I had added the OnLeave though, but it isn't so good >>
>
> ??? Smile

I note the smiley, but rather than have the control think the mouse was still down,
I assumed mouse up when the cursor left.

/Matthew Jones/
Sun, Dec 22 2013 7:35 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I note the smiley, but rather than have the control think the mouse was
still down, I assumed mouse up when the cursor left. >>

Ahhh, gotcha.  Yes, that can cause some non-standard behaviors for the user.

Tim Young
Elevate Software
www.elevatesoft.com
Image