Nifty's onLostFocus interaction

Anyone uses this?

It seems not to want to trigger here…


<control name=“label” id=“pitchDown” text="${dialog.pitchDown}" textHAlign=“left” width=“90px”>

<interact onClick=“pitchDownEnable()” />


<control name=“textfield” id=“pitchDownKey” width=“50px” textHAlign=“center” align=“right”>

<interact onLostFocus=“pitchDownSave()”/>




public void pitchDownEnable() {

screen.findNiftyControl(“pitchDownKey”, TextField.class).enable();

screen.findNiftyControl(“pitchDownKey”, TextField.class).setFocus();


public void pitchDownSave() {

screen.findNiftyControl(“pitchDownKey”, TextField.class).disable();

// save key to GameSettings



Maybe I’m doing it wrong?

Nifty’s wiki does say that:

onLostFocus The element just lost the keyboard/input focus.

So that shouldn't be a case of "it can't be disabled while it's got the focus." since this is supposed to trigger once it has lost the focus...

Checked the logger and no warning, nothing out of the ordinary... :/

Just to add that onClick of the label works fine but I haven’t been able to have onLostFocus of the TextField to trigger.

If someone has 15 mins, would it be possible to have a confirmation please?

Well, after some digging it seems Nifty doesn’t support onLostFocus() as an interact, only those are supported:

“onClick”, “onClickRepeat”, “onRelease”, “onClickMouseMove” (and their related versions onPrimaryClick, onSecondaryClick, onTerniaryClick, etc)

Back to the drawing board I guess. :frowning: