Nifty console not getting key events

I want to make a nifty console which gets enabled when user presses “t” (or whatsoever) and disabled on enter (new line).

When the state gets attached I call the disableConsole() method because the console must be disabled at the start. When “t” is pressed, the console gets focus using enableConsole(), but when I type nothing appears in the console text pane (events still get delivered to game because camera still moves although it shouldn’t).

The enable and disable console functions:

[java]private void disableConsole() {
//Here nifty shouldn’t get events
[java]private void disableConsole() {
nifty.getCurrentScreen().getFocusHandler().setKeyFocus(console); //Yes object console is correctly initialized.
//Here nifty should get events

Maybe is it required to take the focus from the game and give it to nifty and then back?

Sorry for my English.