[JME3] Enable/disable consuming of mouse events by Nifty
Nifty GUI is a Java Library to create OpenGL based user interfaces.
Brought to you by:
void256
Currently Nifty consumes mouse button events (via the InputSystemJme.java) if they occur over a Nifty Element. This is preferable behaviour in most situations. It causes trouble in the following:
Simply adding a RawInputListener to handle the drag is not enough, as it might consume events before they reach the Nifty listener in other use-cases.
A simple fix could be to add a consumeEvents boolean to the InputSystemJme that is checked to see if an event should be consumed or not.
There probably should be two booleans to enable/disable mouse and keyboard event handling individually.
I have a question
will those booleans enable/disable mouse and keyboard handling of every elements or of each individual element?
@xieu90:
The plan is to have a single boolean to completely disable/enable the processing of mouse and keyboard events.
Is anything else required?
Hi Void,
http://download968.mediafire.com/qnv5hnl3wayg/bkxztbcd8n78zpd/mygame11.jar
(Option--> Control)
when you press up arrow then you will see it goes up then down (up because of control of button-I think, and down because of me, I made it go to next element )
at the end I have to use mouse to press on save.
So if your boolean disable both mouse and keyboard events, then it will get rid of up and down problem, but then I wont be able to press save or reset.
After disable the processing of mouse and keyboard events, can we still check if the mouse hovers on any element ? If yes I can manually reenable the boolean and for my case it would be enough.
I dont know if a single boolean for both mouse and keyboard is enough, may be we should have 2, one for mouse and one for keyboard ?
In summary I dont know if anything else is required. We will see after the boolean and the nightly build from jme3 which has that boolean come out.
fixed in git -> https://github.com/void256/nifty-gui/commit/1d359d7122d3448a30c61c81bb00fdfc593b2636
62 [JME3] Enable/disable consuming of mouse events by Nifty (sf.net)
Use nifty.setIgnoreMouseEvents(true) to completely disable mouse event
processing in Nifty . The NiftyInputConsumer.processMouseEvent() will
always return false in that case.
Use nifty.setIgnoreKeyboardEvents(true) to completely disable mouse
event processing in Nifty. The NiftyInputConsumer.processKeyboardEvent()
will always return false in that case.