MouseOverGadget() ?

BlitzMax Forums/BlitzMax Programming/MouseOverGadget() ?

EOF(Posted 2005) [#1]
I might of missed something here but is there a way to find out which gadget the mouse is over?

What I have tried so far is:

* create a panel which covers the GUI area and give it PANEL_ACTIVE status to pick up mouse coordinates

* attach gadgets to the panel and pass their handle to a gadgetlist.

* wait for a MOUSELEAVE event (that is, mouse left the main panel and is over another gadget)

* compare mouse X/Y coordinates to gadget x/y/w/h values to see which gadget the mouse is over


This works 'OK' enough except it's easy to fool the system into thinking the mouse is still over a particular gadget.

Try the example here. Move around to see MouseOverGadget in action. If you run the mouse quickly from the panel to the statusbar (or lower) you'll see the system still reports the mouse to be over the panel.



Ideally I would like a Win32/Mac/Linux friendly method which can correctly report which gadget the mouse is over.


FlameDuck(Posted 2005) [#2]
I might of missed something here but is there a way to find out which gadget the mouse is over?
Not AFAIK. But you can fake it well enough with EVENT_GADGETENTER and EVENT_GADGETLEAVE (or whatever they're called).


Shagwana(Posted 2005) [#3]
I figure that the "SetGadgetFilter" command will do it in the future...

The filter function supplied is called by the Gadget with a TEvent and optional user context object. If the Function returns zero the event is filtered and not processed further by the system whereas a non zero return indicates event processing should proceed as normal.
Currently only EVENT_KEYDOWN, EVENT_KEYCHAR, events produced by TextArea and TextField gadgets can be filtered with the SetGadgetFilter command.