Detecting mouseposition

4 posts / 0 new
Last post
OldFart
OldFart's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 2010-11-30 14:09
Detecting mouseposition

Hi,

Is it possible for an active window to detect whether the mousepointer is hovering over it?

I would like to stop a continuously updating listbrowser suspend updating when the mousepointer is hovering over it, so the user can easily make a selection.

OldFart

thomas
thomas's picture
Offline
Last seen: 3 months 2 weeks ago
Joined: 2011-05-16 14:23
Re: Detecting mouseposition

Just listen for IDCMP_MOUSEMOVE and check that MouseX/Y is between 0/0 and Window->Width/Height. For ReAction windows you probably need a WINDOW_IDCMPHook.

OldFart
OldFart's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 2010-11-30 14:09
Re: Detecting mouseposition

Ok, so I did set up a hookfunction, and added 2 tags to the window-object and verified that the hookfunction is indeed called. So far so good.
But, here's the catch, it seems that the struct WIndow is not filled in: ALL Width and Height values are 0 and TopEdge/LeftEdge receive weird values, somewhere between 20000 and 25000. And these latter ones do vary per session, while the window is in the same place on the screen.

I'm puzzled. What do I miss?

OldFart

thomas
thomas's picture
Offline
Last seen: 3 months 2 weeks ago
Joined: 2011-05-16 14:23
Re: Detecting mouseposition

it seems that the struct WIndow is not filled in

Which struct Window are you talking about? Your hook does not get a pointer to a struct Window. It gets a pointer to the window.class object.

You can use either IntuiMessage->IDCMPWindow or GetAttr() WINDOW_Window from the window object.

Log in or register to post comments