PEAR Progress2 logo

HTML_Progress2 : The Definitive Guide

Strategy of handling

Strategy 1: moveNext
Strategy 2: moveStep

In previous example (pear logo) we have introduced that progress meter can handle two strategies called moveStep and moveNext.

What are the difference, and when use one rather than the other ? Here is the purpose of this section.

Strategy 1: moveNext

When we don't know how many step a progress meter should handle, or if you want to force display to a special value, the right strategy is the most simple : moveNext.

Progress meter will be refresh with : new value = previous value + increment. Increment is defined by setIncrement() method (default = +1).

What you must do:

  1. NEVER return a value in a user callback or user function (depending on processing strategy used).
  2. use only moveNext() method to refresh progress meter.

Strategy 2: moveStep

When task can be divided in many part (knew at runtime) as pear logo example, the right strategy is : moveStep.

What you must do:

  1. compute the right increment : progress meter max value / task count This number should be integer, and round fractions up.
  2. ALWAYS return the next step value in a user callback or user function (depending on processing strategy used).
  3. use only moveStep() method to refresh progress meter.
HTML_Progress2 : The Definitive Guide v 2.4.0 : April 20, 2007