DropDown box not selectable a second time

The following code worked on the past but doesn’t anymore:



[java]import com.jme3.app.SimpleApplication;

import com.jme3.niftygui.NiftyJmeDisplay;



import de.lessvoid.nifty.Nifty;

import de.lessvoid.nifty.builder.LayerBuilder;

import de.lessvoid.nifty.builder.PanelBuilder;

import de.lessvoid.nifty.builder.ScreenBuilder;

import de.lessvoid.nifty.controls.DropDown;

import de.lessvoid.nifty.controls.dropdown.builder.DropDownBuilder;



public class NiftyTest extends SimpleApplication

{

public static void main(final String[] args)

{

new NiftyTest().start();

}



@Override

public void simpleInitApp()

{

final NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);

final Nifty nifty = niftyDisplay.getNifty();

guiViewPort.addProcessor(niftyDisplay);

flyCam.setDragToRotate(true);

nifty.loadStyleFile(“nifty-default-styles.xml”);

nifty.loadControlFile(“nifty-default-controls.xml”);

// Init dropdown

nifty.addScreen(“main”, new ScreenBuilder(“main”)

{

{

controller(null);

layer(new LayerBuilder()

{

{

x(pixels(0));

y(pixels(0));

width(percentage(100));

height(percentage(100));

childLayoutAbsolute();

panel(new PanelBuilder()

{

{

x(pixels(0));

y(pixels(0));

width(percentage(100));

height(percentage(100));

childLayoutCenter();

backgroundColor("#f00f");

control(new DropDownBuilder(“dropdown”));

}

});

}

});

}

}.build(nifty));

nifty.gotoScreen(“main”);

final DropDown drop = nifty.getCurrentScreen().findNiftyControl(“dropdown”, DropDown.class);

drop.addItem(“aaa”);

drop.addItem(“bbb”);

}

}[/java]



The dropdown box contains two elements (“aaa” and “bbb”), and while you can change the selection once, if you try to change it twice, it will not work (clicking the item will not close the box, nothing happens).

Try to update your nifty (version 1.3 was released lately). I had the same problem until I updated.

Updating did not fix it :frowning: Tried using Nifty from jME3_2011-06-27.zip (the one I was using in the original post) and from jME3_2011-06-30.zip (just now).

Did you try with xml? Maybe there is a bug when creating dropdown in java?

I think nightly builds of jme3 don’t contain Nifty 1.3 yet. That bug you mentioned was introduced in a nightly build of Nifty and unfortunatly you’ve got that with jme3 I think.



This will be solved with Nifty 1.3 in the nightly jme3 build because DropDowns work fine (for both XML and JavaBuilder).

This is indeed fixed in Nifty 1.3.1-SNAPSHOT, haven’t tried the other versions

This is indeed fixed in the real Nifty 1.3 release (probably in the Nifty Default Controls 1.3 Release) … and therefore in all 1.3.x-SNAPSHOT versions after that release too.



When building Nifty from SVN please note that 1.3.x versions will only be reserved for bugfixes. 1.4 will probably use git … stay tuned for further informations (probably on the Nifty GUI blog)