Hi all,
I'm a total noob in SWT, just getting started, but I have previously worked with GUI frameworks such as Swing.
I have a Composite which contains a Group and a Button. The Group is initially set to invisible (using group.setVisible(false)), and is set to visible when clicking the button. This starts a thread which perform some calculations, updating a label inside the group with the progress (kind of a manual progress bar. This is what the customer wants :) ).
Anyway, for some reason, the group only appears after the thread has finished running, and I can't seem to make it appear, no matter what I've used (tried calling this.pack(), this.layout(), this.getShell().layout(), redraw() on a variety of controls in the path - nothing).
Here's how I create the group:
statusGroup = new Group(this, SWT.SHADOW_NONE);
statusGroup.setLayout(null);
statusGroup.setVisible(false);
percentCompleteLabel = new Label(statusGroup, SWT.NONE);
percentCompleteLabel.setText("0% complete");
Here's how I'm updating it from the Button's SelectionListener:
this.statusGroup.setVisible(true);
this.statusGroup.pack(true);
this.statusGroup.layout();
this.getShell().layout();
myThreadStartupCode(); // psuedo
while (!workIsDone) // psuedo
{
final int progress = myProgressCalcMethod(); // psuedo
percentCompleteLabel.setText(progress + "% complete");
percentCompleteLabel.pack(true);
this.layout();
this.redraw();
Thread.sleep(100);
}
Any clue would be appreciated.