TextField Control

How do you set focus to the textfield control now?



TextFieldBuilder has no methods for setting/getting focus and the Element.setFocus does nothing.



As well, I still am having no luck trying to get the textfield to resize. Unlike all other controls/elements, if you set the size (say width) to a relative size (i.e. % or *), it does not resize when the parent is resized. It’s position stays relative, but will not resize.



Lastly, is there a way to completely disable Nifty’s handling of events? I would prefer to handle them a different way, seeing as I am using Enter to enable and then submit/disable chat functions… so many hotkey functionality depends completely on the state of the chat window focus. I REALLY do not want to have event handling in multiple places in the client app and I had already written code for determining whether the mouse has GUI focus or not and event consumption. It seems that some controls/elements are consuming events by default and others are not and until I can figure out a way to disable Nifty event consumption… my implementation is fighting with nifty and causing havoc through the code :frowning:

  1. Currently you’ll need to access the element and call setFocus() which worked for me when I’ve tried it one minute ago. The only thing that has changed in 1.3 is, that it is now possible to disable controls (or elements) and disabled controls are not focusable. So I don’t know, maybe your elements are disabled for some odd reason? Elements start in enabled state tho, so this might be unlikely.


  2. Do you call screen.layoutElements() or element.layoutElements() after you modify the constraints?


  3. There is currently no way to disable input processing in Nifty. Maybe there is a way in the JME-specific InputSystem to disable this as a workaround but Nifty currently does not provide a way for this. Maybe create a feature request for this at the sf.net feature request tracker?