Hover over gadget

5 posts / 0 new
Last post
mritter0
mritter0's picture
Offline
Last seen: 2 weeks 2 days ago
Joined: 2014-04-21 21:15
Hover over gadget

I have started a new gadget class. This one is just a button (not buttonclass) with text.

How do I know when the mouse is hovering over the gadget? I would like to know so I can alter the border and/or text. I don't seem to be getting any GM/OM_xxx signals. Or I am looking at the wrong one?

I would have thought GM_QUERY would be the place to check, but not having any luck. Check input event for timer, check coordinates, if good then render with hover state.

xenic
xenic's picture
Offline
Last seen: 2 months 1 day ago
Joined: 2011-05-07 04:52
Re: Hover over gadget

@mritter
Since nobody has an answer to your query, I'll just point out the fact that the WIndow structure contains mouse positions (MouseX & MouseY) relative to the upper left of the window. I'm no sure how often Intuition updates the mouse position in the Window structure but I suspect it's with every Intuitick (~tenth of a second). If you set IDCMP_INTUITICKS in the window's IDCMP flags (WA_IDCMP) you should be able to use "case WMHI_INTUITICK:" to check the mouse position.

X1000 - OS 4.1FE
mritter0
mritter0's picture
Offline
Last seen: 2 weeks 2 days ago
Joined: 2014-04-21 21:15
Re: Hover over gadget

@xenic
Thanks. I have some old code that does what I want, but it is a totally different kind of class, so still trying to figure it out. It uses a timer event. I haven't done much since I sent my X5000 out to California for AmiWest.

mritter0
mritter0's picture
Offline
Last seen: 2 weeks 2 days ago
Joined: 2014-04-21 21:15
Re: Hover over gadget

I still can't figure this one out. GM_HELPTEST notifies me when the mouse is over the gadget so I can change the hover state. But I don't get a notification when the mouse is moved away to change the hover state back to normal state.

I really need this, guys. Any help is appreciated.

mritter0
mritter0's picture
Offline
Last seen: 2 weeks 2 days ago
Joined: 2014-04-21 21:15
Re: Hover over gadget

After a lot more digging into the code, I found out that the original programmer was listening for IDCMP_MOUSEMOVE and changing the gadget state manually. It was not done through the gadget class. salass00 has mentioned he would like to add it into WindowClass, so maybe down the road we will have this ability built in.

Log in or register to post comments