Nifty and TextField?

Hi folks, just started playing with Nifty today, and have the basic buttons working without any issues, but I can’t figure out the for life of me…whats going on with TextFields…using

TextField txt = screen.findNiftyControl(“input”, TextField.class);

Always returns a TextFieldNull object (from what I understand…this means the control doesn’t exist in the screen).



Essentially I create a textField using the following:



[xml]<screen id=“start” controller=“com.hpg.ui.StartScreen”>

<layer id=“background” childLayout=“center”>

<image filename=“Interface/start-background.png”></image>

</layer>

<layer id=“foreground” childLayout=“horizontal”>

<panel childLayout=“horizontal” align=“left” width=“50%”>

<text text=“Name” font=“Interface/Fonts/Default.fnt” width=“100%” height=“10%” wrap=“false”/>

</panel>

<panel id=“panel_textfield” backgroundColor="#f03f" childLayout=“horizontal” width=“50%” height=“10%” >

<control

id=“input”

name=“textField”>

</control>

</panel>

</layer>

</screen>[/xml]



In the onStartScreen() as a test I’m doing the following (which always fails…and looking at the debugger, the TextField returned is actually an instance of TextFieldNull).



[java] public void onStartScreen() {

System.out.println(“startScreen::onStartScreen called”);

Screen screen = nifty.getCurrentScreen();

TextField txt = screen.findNiftyControl(“input”, TextField.class);

txt.setText(“HELLOO…”);

}[/java]



I assume I must be doing something wrong? any pointers?



(note: I am using the latest stable release).



thanx

As can be seen here: http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Standard_Controls_TextField (and probably in the Nifty Bible as well), the TextField control’s name is “textfield” (with no capital letters).

Try if that works better.

doh!

Yeah.the ‘nifty bible’ link appears to be broken, and finding the manual also was a bit of challenge…it doesn’t appear to be linked from the jmonkey links correctly (but …yeah…I found it at:http://jaist.dl.sourceforge.net/project/nifty-gui/nifty-gui/nifty-gui-the-manual-v1.0.pdf) and indeed…its lower case



But indeed that worked like charm :slight_smile:



thanx

There is a link to the nifty manual on the drag and drop help section of the bar to the right…(it works for me, I just tested it)

HI all, It seems I’ve lost my copy of the pdf for the manual…anyone have copy or know a link that works?

(where is this 'drag and drop help section?)

nm, I see the ‘drag and drop’ section is just the Quick Help section on the right side of this page :slight_smile:

I think they renamed it :slight_smile: