HTML_Progress2 : The Definitive Guide |
Table of Contents
Sometimes you can't immediately determine the length of a long-running task, or the task might stay stuck at the same state of completion for a long time.
You can show work without measurable progress by putting the progress meter in indeterminate mode. A progress meter in indeterminate mode displays animation to indicate that work is occurring. As soon as the progress meter can display more meaningful information, you should switch it back into its default, determinate mode.
We will learn, with two examples, how to use indeterminate mode. The first example apply basic concept, and the second example show an integration with a progress monitor.
In following example we will simulate a task that display a progress meter in indeterminate mode waiting for a ressource (mail post, file upload, ...). We are waiting 12 seconds before switch back to determinate mode (default) and finish process with a full loop from 0 to 100% by +5 step increment.
Strategies used are :
myProcess
)
Here is a preview of a progress bar in indeterminate mode. Animation look like a sliding box.
And now the script we will review step by step to understand concepts.
Once the progress bar is switch back to determinate mode, we will reset value to zero to start a new standard cycle (from 0 to 100%).
Without this reset step, the progress meter continue until end (100%) from its current position (unpredictable).
Increment is set to 10 to give, with a 0.2 second (200 milisecond) delay, a smooth animation.
Indeterminate mode is
activated(/desactivated) only with setIndeterminate()
method.
myProcess function is the user process that will simulate a waiting resource for 12 seconds, and finish in determinate mode.
HTML_Progress2 : The Definitive Guide | v 2.4.0 : April 20, 2007 |