User avatar
digimbyte
Topic Author
Posts: 47
Joined: 14 Nov 2017, 21:42

Handling mouse events on Gui with c#

24 Feb 2019, 10:39

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

Re: Handling mouse events on Gui with c#

25 Feb 2019, 16:18

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.

Who is online

Users browsing this forum: No registered users and 1 guest