ListBox displays nothing

Hello I have a problem my listBox blank: / here is my code


ListBox listBox = nifty.getCurrentScreen().findNiftyControl("myListBox", ListBox.class);




and my Xml


<control name="listBox" id="myListBox" displayItems="4" color="#ffffff" horizontal="off" visibleToMouse="true" forceSelection="true" selectionMode="Single" y="140" width="90%"x="5%" height="50%" ></control>


nothing appears I have a list box empty

:confused: thanks

Try debugging it to make sure that listBox is not null when you try to add items to it.

[java]ListBox listBox = nifty.getCurrentScreen().findNiftyControl(“myListBox”, ListBox.class);







iif I get the items I have “b, c” … it’s strange

When do you do that code? In the bind event?

an element of nifty call a function. But even if I put it in another class it does not work


Here is the URL to the default control - ChatControl. It should provide a decent example of how it can be done.;a=tree;f=nifty-controls/src/main/java/de/lessvoid/nifty/controls/chatcontrol;hb=refs/heads/1.3.1

This is the Java code.

The XML code can be found here:;a=blob;f=nifty-controls/src/main/resources/nifty-controls/nifty-chat-control.xml;h=2817999e9d8cbe14330112a9f46be933007b3ed6;hb=refs/heads/1.3.1