Handling mouse events on Gui with c#
I've searched on google for the last few days but I can't seem to find any code examples or documentation of how to handle mouse events in c#
https://www.noesisengine.com/docs/Gui.C ... ement.html
I'm interested in detecting closing panels if the user clicks on some other part of the UI or in world space
how would I attach a passive script on my UI element as some sort of event listener?
or would it be better to have it in a main mouse event script?
https://www.noesisengine.com/docs/Gui.C ... ement.html
I'm interested in detecting closing panels if the user clicks on some other part of the UI or in world space
how would I attach a passive script on my UI element as some sort of event listener?
or would it be better to have it in a main mouse event script?
-
-
sfernandez
Site Admin
- Posts: 2534
- Joined:
Re: Handling mouse events on Gui with c#
You can use hit testing to determine if a mouse click hit the UI or not. Take a look at this post: viewtopic.php?f=3&t=1550
Antoher option is to capture mouse (element.CaptureMouse()) when you open a panel, so all mouse events are redirected to the element, and then check against element bounds to see if user clicked outside the element.
Antoher option is to capture mouse (element.CaptureMouse()) when you open a panel, so all mouse events are redirected to the element, and then check against element bounds to see if user clicked outside the element.
Who is online
Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 3 guests