PDA

View Full Version : ProgressBar text aligned wrong if initially hidden



silv
29 Jul 2009, 10:42 AM
The ProgressBar widget looks to have a few problems if it is initially hidden when rendered.

The ProgressBar update text gets aligned left (not middle), and then the two different colors of text get misaligned, as the white text gets centered on the "inner" progress bar, while the darker one remains left-aligned.

I've tested this on FF 3.5 and Safari 4. GWT 1.7 and GXT 2.0.1.

There is a small test case to show this:



public class Samplebug implements EntryPoint {

static float percent = 0;

public void onModuleLoad() {

Viewport v = new Viewport();
v.setLayout(new FitLayout());

final ProgressBar prg = new ProgressBar();
prg.hide();

final Timer t = new Timer() {
public void run() {
percent +=1;
prg.updateProgress(percent / 100, Float.toString(percent));
}
};

Button b = new Button("Go");
b.addSelectionListener(new SelectionListener<ButtonEvent>() {

@Override
public void componentSelected(ButtonEvent ce) {
t.scheduleRepeating(500);
prg.show();
}

});

v.add(prg);
v.add(b);
RootPanel.get().add(v);
}
}
Click the "Go" button to make the ProgressBar appear and start counting out.

If I am doing something wrong here, and there is a better way to have the ProgressBar hidden until something triggers it please let me know!

sven
29 Jul 2009, 10:43 AM
You need to change the HideMode to something different than DISPLAY. Moving this to the help forum.

silv
29 Jul 2009, 11:09 AM
Thanks Sven. That fixed it. Sorry for cluttering up the bugs forum.

Arno.Nyhm
30 Jul 2009, 5:27 AM
can you give the solution code snippet for your problem?

silv
30 Jul 2009, 6:34 AM
I just set HideMode to OFFSETS and it worked. However it also still breaks if you are in a FormLayout(), but that may not be supported. I'm not sure.