I don’t know if this is the best forum for this, it may be better to use some Nifty forum but I’ve used this forum before and everyone seemed really helpful.
I’m using a Nifty screen as the HUD for my game and the hud has a textfield in it. The problem is that the textfield has default focus and taking all my keyboard input and theres no way to unfocus it. Ideally I want it to lose focus if i just click somewhere else. I’ve been reading the Nifty manual trying to figure what I need to do but the way its broken up is really confusing. I’m using XML to create the screen so I’m not sure how I should go about this. I know I need to do something with input handling of mouse events and then do something to disable the textfield’s focus but this is my first thing using JME and Nifty so I’m a bit lost when it comes to some things.
I wanted to ask some more specific questions but I realized I don’t even know what questions to ask. I think I’m just having trouble figuring out
where how to begin. Thats what I need help with the most. I know i have to use input handing somehow.
Basically I just want to know:
How do I make a textfield not focused by default when its created with xml?
Figured it out using screen.getFocusHandler().resetFocusElements() in bind method of screen controller
How do I unfocus that textfield when I click anywhere else?