Page 1 of 1
Knowing an event has been used?
Posted: 09 Mar 2022, 14:57
by dazza
When I push an event, say a mouse click in to Noesis how do I know if that event has been consumed (for example used by a button). I need to know if a click should be sent to the "game" underneath the UI layer.
Re: Knowing an event has been used?
Posted: 10 Mar 2022, 10:38
by sfernandez
As indicated in
IView comments, all input events injected to the view return a bool that indicate if the event has been handled by the UI.
/// Notifies that a mouse button was pressed. Origin is in the upper-left corner.
/// Returns true if event was handled
virtual bool MouseButtonDown(int x, int y, MouseButton button) = 0;
You can also use
VisualTreeHelper::HitTest() to determine if mouse is over any UI element, sometimes that is also useful.
Re: Knowing an event has been used?
Posted: 10 Mar 2022, 15:25
by dazza
Ah, thank you I missed that
Re: Knowing an event has been used?
Posted: 11 Mar 2022, 19:45
by sfernandez
You're welcome, marking this as solved.