Nifty-GUI: DropDown Control not populating

Hey Everyone!

Just looking for a bit of help with a dropdown issue I’m having with nifty. I’ve taken a look at some examples but I do not appear so see where I’m going wrong. It appears when I create the variable in java and try to link it to the niftyxml, it’s not linking properly and/or doesn’t find the control properly. I hope that made sense.

XML For DropDown:
[java]
<control id=“ddbRes” name=“dropDown” x=“75%” y=“30%” width=“25%”/>
[/java]

Java (After Init for nifty is complete and all the XML files have been added):
[java]
VIDEO_ResDrop = nifty.getScreen(“Options”).findNiftyControl(“ddbRes”, DropDown.class);
[/java]

Java (Where it tries to populate the dropdown):
[java]
for (DisplayMode mode : modes){
if (mode.getBitDepth() == 32 && mode.getRefreshRate() >= 60){
VIDEO_displaymodes.add(mode);
String item = " " + mode.getWidth() + “x” + mode.getHeight() + " @" + mode.getRefreshRate();
System.out.println(VIDEO_ResDrop);
VIDEO_ResDrop.addItem(item);
}
}
System.out.println("COUNT: " + VIDEO_ResDrop.itemCount());
[/java]

and just because, the results that system.out has produced:
[java]
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
de.lessvoid.nifty.controls.nullobjects.DropDownNull@63e79aa3
COUNT: 0
[/java]

If anyone could toss some suggestions my way I would be grateful!

  • Josh

This is working now, if it’s the correct way I’m not to sure but it’s working and that’s what counts right?

Incase anyone else has this issue:

I used DropDownControl (even though its depreciated) it seems to work, tried the same method with just DropDown but no avail.

[java]
Private DropDownControl VIDEO_ResDrop;



public void bind(Nifty nifty, Screen screen) {
if(screen.getScreenId().equals(“Options”)){
VIDEO_ResDrop = screen.findNiftyControl(“ddbRes”, DropDownControl.class);
}
}[/java]

After that I could added items and what not.