In my Nifty screens, when I click a TextField, Nifty does not give focus to it.
Is this the expected behaviour?
As far as I know it just uses string comparison so I doubt it would be a problem. You can try changing it though.
You are sure it is a text field control not just a text renderer?
Check all your screen controllers are registered correctly, once, and only once.
In my Nifty screens, when I click a TextField, Nifty give focus to it.
Is this the expected behaviour?
I don't know but I would expect this behavior :) Whats the issue with it?
Edit: I just see your headline and text doesn't match. Does it or doesn't it focus?
TextFields are focusable per default, and usually that is the expected behaviour and desired behaviour.
If you just want a text, you should be using label.
However if the behaviour is as you state in the topic header, that it is NOT working,
consider checking if you have layers/panels that overlap the field that were added on later on which might consume the mouse events before it reaches the textfield.
The title was correct, somehow the “does not” got edited out from the message body.
Thanks for the feedback. At least I know what to look for now.
This is really strange.
Mouse clicking on buttons works (triggers the action I tied to it).
Mouse clicking on scrollbars works (focuses it).
Mouse clicking on TextField half-works: it highlights when I move the mouse over it, but it doesn’t get focus.
After switching to a new screen and back, mouse clicking on buttons stops working: they highlight, they show the “I am being clicked” animation, but the action does not get triggered anymore.
Where should I look first?
Does Nifty choke on control IDs like “15”?
Heh. Thanks for the feedback, and it gave me some pointers to check.
Source code browsing revealed that Nifty constructs purely numeric IDs internally, and also IDs like “some_user_defined_id#field”.
It didn’t cause my problems, but I changed the ID generation to prefix the numbers with a constant string just to make sure I’m not getting ID number conflicts down the road.
Other than that, everything turned out to be okay. IOW I ended with a code review and a few fixed minor bugs.
The real cause was a version mismatch, I had overlooked upgrading nifty-style-black to 1.4 when I upgraded all other Nifty components. I hadn’t expected a style to affect functionality, but in this case, it did. Phew.
In related news, buttons are still not accepting mouse clicks or key presses after returning to a screen that was once open, but I have the strategy to debug that laid out already.
I’ve been seeing an intermittent problem recently with a panel stopping responding to click events sometimes when you return to a previously-open screen. (It’s a panel not a control, interact=“func()” style, it all works fine most of the time but occasionally when you reopen the screen the func() never gets called when you click the panel).
If you make any headway on that I’d be interested to hear the results as it may apply to the issue I have (I’ve not had much time to investigate yet, too much other stuff to do and it’s a fairly rare intermittent issue).
Dangit. I can’t reproduce the problem after reboot.
@zarch If your panel is a popup, and you’re using Nifty.subscribe, you need to resubscribe whenever reopening the popup. Nifty auto-unsubscribes popups on close.
Just in the unlikely case that that’s your problem.
Hmm, thanks but I don’t think that can be it. It’s a panel in the screen (it does get hidden/reshown by effects) but its just a standard panel. The interaction is also through interact onClick tags rather than event listeners too.
Zarch I have a similar problem, where sometimes, when i unhide a panel from the current screen it does not respond to the first click, but does for subsequent clicks.