Stop ProgressBar which is running SWT.INDETERMINATE [message #372004] |
Sat, 26 July 2003 07:31  |
Eclipse User |
|
|
|
Originally posted by: simon.rutishauser.gmx.ch
hi,
does anyone know how I can stop a progressbar created like this:
ProgressBar p = new ProgressBar(parent, SWT.INDETERMINATE);
now I'd like to stop it at some time. Just like setting
p.setRedraw(false), but actually this also prevents the bar from being
redrawn when it should (another window temporarily before progressbar)
Peschmä
|
|
|
Re: Stop ProgressBar which is running SWT.INDETERMINATE [message #372012 is a reply to message #372004] |
Sun, 27 July 2003 01:58   |
Eclipse User |
|
|
|
Originally posted by: burner.zclipse.org
On Sat, 26 Jul 2003 13:31:08 +0200, Simon Rutishauser wrote:
> hi,
>
> does anyone know how I can stop a progressbar created like this:
>
> ProgressBar p = new ProgressBar(parent, SWT.INDETERMINATE);
>
> now I'd like to stop it at some time. Just like setting
> p.setRedraw(false), but actually this also prevents the bar from being
> redrawn when it should (another window temporarily before progressbar)
setRedraw() is definitely not what you want.
It sounds like what you want is p.setEnabled(false), but that doesn't seem
to work (at least on linux/gtk2, the progressbar continues to update after
setEnabled(false) is called). Perhaps this is a bug, or maybe my
understanding of what setEnabled() does for a ProgressBar is off.
Could you live with p.setVisible(false), and just have the progressbar
disappear?
> Peschmä
--
http://zclipse.org
|
|
|
Re: Stop ProgressBar which is running SWT.INDETERMINATE [message #372013 is a reply to message #372012] |
Sun, 27 July 2003 03:13   |
Eclipse User |
|
|
|
Originally posted by: burner.zclipse.org
On Sun, 27 Jul 2003 01:58:02 -0400, Michael R Head wrote:
> It sounds like what you want is p.setEnabled(false), but that doesn't seem
> to work (at least on linux/gtk2, the progressbar continues to update after
> setEnabled(false) is called). Perhaps this is a bug, or maybe my
> understanding of what setEnabled() does for a ProgressBar is off.
>
I just checked this out with a native GTK app, and the progress bar
doesn't seem to honor the gtk_widget_set_sensitive call, so
ProgressBar.setEnabled() can't work under GTK.
My suggestion would be to either use setVisible() or swap out the
SWT.INDETERMINATE progress bar for a standard progress bar when you want
to show that the process is complete. (that is, use the indeterminate one
while the process is proceeding, but when the process is complete, remove
the indeterminate one and add a determinate one with
setSelection(getMaximum()) or thereabouts.
mike
>
>
>> Peschmä
--
http://zclipse.org
|
|
|
|
Re: Stop ProgressBar which is running SWT.INDETERMINATE [message #372015 is a reply to message #372004] |
Sun, 27 July 2003 03:23  |
Eclipse User |
|
|
|
Originally posted by: burner.zclipse.org
OK, last time replying to this thread (for some reason it piqued my
interest).
Anyway, I don't think there's a good way to do exactly what you want, but
you might be able to use this to get close to the same effect:
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
public class ProgressBarTest {
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
final org.eclipse.swt.widgets.Composite comp = new org.eclipse.swt.widgets.Composite(shell, SWT.NONE);
final ProgressBar bar = new ProgressBar(comp, SWT.INDETERMINATE);
final ProgressBar barComplete = new ProgressBar(comp, SWT.SMOOTH);
barComplete.setMaximum(2);
bar.setSize(300, 20);
barComplete.setSize(300, 20);
shell.setLayout(new RowLayout());
shell.pack();
shell.open();
new Thread() {
public void run() {
try {sleep(5000);} catch (InterruptedException e) {}
display.syncExec(new Runnable() {
public void run() {
barComplete.setSelection(1);
barComplete.moveAbove(bar);
}
});
try {sleep(5000);} catch (InterruptedException e) {}
display.syncExec(new Runnable() {
public void run() {
barComplete.moveBelow(bar);
}
});
}
}.start();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
--
http://zclipse.org
|
|
|
Re: Stop ProgressBar which is running SWT.INDETERMINATE [message #372016 is a reply to message #372013] |
Sun, 27 July 2003 03:23  |
Eclipse User |
|
|
|
Originally posted by: simon.rutishauser.gmx.ch
....
> My suggestion would be to either use setVisible() or swap out the
> SWT.INDETERMINATE progress bar for a standard progress bar when you want
> to show that the process is complete. (that is, use the indeterminate one
> while the process is proceeding, but when the process is complete, remove
> the indeterminate one and add a determinate one with
> setSelection(getMaximum()) or thereabouts.
not really, as I only have to stop the bar if the thing _fails_ and
therefore is not complete. But as I pointed out in my other posting I'll
try it with using a standard bar and simulating the INTDETERMINATE style
on my own
Peschmä
|
|
|
Powered by
FUDForum. Page generated in 0.05890 seconds