I am trying to catch click events using an ActionListener, specifically for use in a Lemur interface. (I have a drop own control that needs to be detached when the user clicks anywhere, and there are many other containers also catching clicks, so I cannot manage to do this with a single lemur mouse listener attached to a panel in the background).
In the process of doing this, I noticed that the standard ActionListener ignores MouseTriggers if you set the cursor to be visible with inputManager.setCursorVisible(true)
Is this intended to work this way? And if so does anyone have any suggested workarounds?
Thanks! I did not know about that class before, but it looks quite useful. I looked over the javadoc and also found the Mouse.isButtonDown(int button) method, so everything is working now.
You should be able to set one invisible panel in the background of everything in the guiNode… it will catch all of the clicks that don’t get grabbed by something else.
Unfortunately in this situation there are lots of other containers in the same interface that are also catching clicks, so It left many unrelated Containers where I could click without it being caught by the invisible background container.
I did not know that a Popup already existed, and made a custom DropDownContainer class that extends Container, but it sounds like I may have reinvented the wheel in a worse way haha.
Do you have a link to an example using a popup in JME? I’m having trouble finding it with a google search for some reason. Is it a lemur speific class?
I mean, I guess… but what is it that you are actually trying to do? Because you could also place a cull always quad in the scene itself and get actual coordinates with a cursor listener.
Edit: but yes, if you put a screen size quad in the background of the GUI node then you can get x,y from the cursor listener on that quad. Just be careful what you consume if you also want the 3D scene to have picking.