Bar Progress

I’m designing an application, but before running I want to generate a window in Lemur which display a progress bar or loading. With Lemur I can design this type of windows?

thank you

Yes, Lemur even has a built in progress bar now. It’s called (not coincidentally): ProgressBar. :slight_smile:

jaja, yes i saw that. But i don’t know how implemented that. I generate this progress bar with this code and that doesn’t work. I want to generate this progressbar animated and when this progress is finished, it can open other window.

[java]
ProgressBar inicio = new ProgressBar(“glass”);
inicio.setLocalTranslation(1024, 900, 0);
inicio.setProgressValue(100);
inicio.setProgressPercent(0.1);
Progress.addChild(inicio);
[/java]

Thanks

First of all you have to initialize the gui (this = the Application):

[java]GuiGlobals.initialize(this);[/java]

After that, if you want to use the glass style (as you are doing in your code) you need to load it:

[java]BaseStyles.loadGlassStyle();[/java]

And then you should create a Container and attach it to the guiNode

[java]Container c=new Container();
c.setLocalTranslation(new Vector3f(0,this.getContext().getSettings().getHeight(),0));
this.guiNode.attachChild©;[/java]

And finally you can add your progressbar to the container

[java]c.addChild(inicio);[/java]

For animating the bar, you can use a timer or a thread or just override the update() method in Application and increase the progressPercent at each tick.

@Riccardo is pretty much right on with one addendum: you technically can add the progress bar right to the guiNode without a container… but you will likely want to set a preferred size because the default size is probably not what you want. (Even when you put it in a container, you will probably want to set the container’s default size.)

Now, as to your other issues…

These two lines:
inicio.setProgressValue(100);
inicio.setProgressPercent(0.1);

…are just different ways of setting the same value. So the first one is redundant. If you are trying to set the maximum value then you need to set that on the model. (Though the default is already 100.)

After that you can use setProgressValue() or setProgressPercent() to set how much progress there has been in whatever task you are trying to track.