1. mouse outside window

Hi, been lurking a long time but now I've got a problem...
I need to know when the mouse cursor (in Windows) leaves a window.  I've
tried using SetCapture but this won't detect a "move" event outside the
window, probably because there's no x,y co-ordinate to return.  I'm stumped,
does anyone have any ideas?

chris

new topic     » topic index » view message » categorize

2. Re: mouse outside window

chrissy wrote:

> I need to know when the mouse cursor (in Windows)
> leaves a window.

To track the mouse, you can:

1. Set a timer when you start tracking.

2. When the timer goes off, use getMousePos to find the position of the
mouse.

3. Use isScreenPointIn to find if the mouse is still in the window

4. Use onLostFocus to see if the window loses focus during the drag.


Don't forget to kill the timer when you are done tracking the mouse.

Hope this helps!

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

3. Re: mouse outside window

> > I need to know when the mouse cursor (in Windows)
> > leaves a window.
>
> To track the mouse, you can:
>
> 1. Set a timer when you start tracking.
>
> 2. When the timer goes off, use getMousePos to find the position of the
> mouse.
>
> 3. Use isScreenPointIn to find if the mouse is still in the window
>
> 4. Use onLostFocus to see if the window loses focus during the drag.
>
>
> Don't forget to kill the timer when you are done tracking the mouse.
>
> Hope this helps!
>
> -- David Cuny

Didn't need the last point as I wasn't dragging but yeah, that seems to do
the job -  thanks!  It would never have occured to me to use a timer.

chris

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu