0
\$\begingroup\$

I am currently trying to apply an overlay with LibGDX over my 3D ModelBatch. Everything works fine except for the SelectBox. Once instanciated, it shows up on my screen I can click on it once but then it freezes. The drop-down list is not displayed and the clicks are no longer registered by my application. However, if my second click is under the standard position of the list, that is where it should be drawn when it drops down, an item is selected but then any third click will just return the list to the original selected item and no click is registered by my application anymore. I am running the application on Desktop.

Using break points in the SelectBox.class I was able to notice that the third and other next clicks are registered by the SelectBox.class as part of the list in the Listener responsible for selecting an item.

selectBox = new SelectBox<Object>(skin);        
selectBox.setItems(array);
selectBox.setSelected("Custom");
stage.addActor(selectBox);

array in this case is an instance of Object[] containing only Strings. This is the only part of code I have related to the selectBox.

I have tried using an array of String[] at first but then switched to Object as suggested on a LibGDX forum.

I am currently using the latest Nightly Build of 2014/04/11 as I also need TextArea which is not yet in the stable release. However, I have tried the stable release 0.9.9 and it doesn't work either.

Am I using the right code to declare my SelectBox, or what could I do to make the SelectBox behave properly that is display its list when clicked and return to a normal state after an item is selected?

\$\endgroup\$
1
  • \$\begingroup\$ Is there an error message or does the program just freeze? \$\endgroup\$ – StrongJoshua May 14 '15 at 19:36
-1
\$\begingroup\$

Just had a similar problem. The following code in the render method of the screen helped:

stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f));
\$\endgroup\$
2
  • \$\begingroup\$ Can you tell us what problem this is solving? How it it solving it? What does that code do? \$\endgroup\$ – MichaelHouse Mar 14 '15 at 21:48
  • \$\begingroup\$ This is unlikely to solve the problem, since not calling the method would not result in a crash. Also, you don't need to call it with arguments, stage.act(); would suffice. \$\endgroup\$ – StrongJoshua May 14 '15 at 1:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.