How to find widget under mouse cursor?


11-01-2011 20:50:14

How can I find out which widget is currently under the cursor? The only way I could think of was to add a mouseMoved listener and then store a pointer somewhere, which seems like overkill. Is there an easier way?


12-01-2011 08:54:49

For widgets under mouseMyGUI::Widget* focus = MyGUI::InputManager::getInstance().getMouseFocusWidget();Also you can use MyGUI::Widget* widget = MyGUI::LayerManager::getInstance().getWidgetFromPoint(positionX, positionY);


12-01-2011 16:23:10

Thanks Altren, I used
getWidgetFromPoint(positionX, positionY);
worked great. Now I have a problem knowing when the mouse leaves or enters a widget, see