dazza
Topic Author
Posts: 14
Joined: 10 Jan 2022, 20:41

Knowing an event has been used?

09 Mar 2022, 14:57

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.
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Knowing an event has been used?

10 Mar 2022, 10:38

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.
 
dazza
Topic Author
Posts: 14
Joined: 10 Jan 2022, 20:41

Re: Knowing an event has been used?

10 Mar 2022, 15:25

Ah, thank you I missed that
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: Knowing an event has been used?

11 Mar 2022, 19:45

You're welcome, marking this as solved.

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 13 guests