Nifty: Changing the default displayItems size of a drop down list

I created a nifty DDL using java builder and this tutorial: http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Standard_Controls_DropDown

The tutorial mentions that the default displayItems size is 4. How can I increase it?

I checked the API for that class and I still can’ t figure it out: DropDown (Nifty Default Controls 1.3 API)

can anyone help?

Anyone?

@void256??

The problem is, that DropDownBuilder does not expose the displayItems property with a dedicated method (missing feature really). You can work around it using the general method to set an attribute though:

[java]control(new DropDownBuilder(“dropDown”) {{
width("*");
set(“displayItems”, “10”); // have to use the general set(key, value) method since there is no dedicated “displayItems” method
}});[/java]

It would not be hard to add if you look at the source of DropDownBuilder: https://github.com/void256/nifty-gui/blob/1.4/nifty-controls/src/main/java/de/lessvoid/nifty/controls/dropdown/builder/DropDownBuilder.java

1 Like

great! Thanks

Check this out: https://github.com/void256/nifty-gui/pull/158 :smiley:

Nifty 1.4 will have that method :wink: