| Current File : //opt/RZphp5/includes/doc/HTML_Progress2/docs/TDG/ch05s03.html |
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>
Strategy of handling
</title>
<link rel="stylesheet" href="book.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1" />
<link rel="start" href="index.html" title="HTML_Progress2 Manual" />
<link rel="up" href="ch05.html" title=
"Chapter 5. Quick Start with HTML_Progress2" />
<link rel="prev" href="ch05s02.html" title="Processing " />
<link rel="next" href="ch06.html" title=
"Chapter 6. Indeterminate Mode" />
<style type="text/css">
/*<![CDATA[*/
body {
background-color: white;
color: black;
}
:link { color: #0000FF }
:visited { color: #840084 }
:active { color: #0000FF }
h2.c1 {clear: both}
/*]]>*/
</style>
</head>
<body>
<table class="progress2Header">
<tr>
<td>
<img src="img/pear_progress2.gif" align="left" alt=
"PEAR Progress2 logo" />
<h1>
HTML_Progress2 : The Definitive Guide
</h1>
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">
Strategy of handling
</th>
</tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="ch05s02.html">Prev</a>
</td>
<th width="60%" align="center">
Chapter 5. Quick Start with HTML_Progress2
</th>
<td width="20%" align="right">
<a accesskey="n" href="ch06.html">Next</a>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<div class="sect1" lang="en" xml:lang="en">
<div class="titlepage">
<h2 class="title c1">
<a name="quickstart.strategy" id="quickstart.strategy"></a>Strategy
of handling
</h2>
</div>
<div class="toc">
<dl>
<dt>
<span class="sect2"><a href="ch05s03.html#id4787845">Strategy 1:
moveNext</a></span>
</dt>
<dt>
<span class="sect2"><a href="ch05s03.html#id4785293">Strategy 2:
moveStep</a></span>
</dt>
</dl>
</div>
<p>
In previous example (pear logo) we have introduced that progress meter
can handle two strategies called <span class=
"emphasis"><em>moveStep</em></span> and <span class=
"emphasis"><em>moveNext</em></span>.
</p>
<p>
What are the difference, and when use one rather than the other ? Here
is the purpose of this section.
</p>
<div class="sect2" lang="en" xml:lang="en">
<div class="titlepage">
<h3 class="title">
<a name="id4787845" id="id4787845"></a>Strategy 1: moveNext
</h3>
</div>
<p>
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 : <span class="emphasis"><em>moveNext</em></span>.
</p>
<p>
Progress meter will be refresh with : <code class="literal">new value
= previous value + increment</code>. Increment is defined by
<code class="methodname">setIncrement()</code> method (default = +1).
</p>
<p>
What you must do:
</p>
<div class="orderedlist">
<ol type="1">
<li>NEVER return a value in a user callback or user function
(depending on <a href="ch05s02.html" title="Processing ">processing
strategy</a> used).
</li>
<li>use only <code class="methodname">moveNext()</code> method to
refresh progress meter.
</li>
</ol>
</div>
</div>
<div class="sect2" lang="en" xml:lang="en">
<div class="titlepage">
<h3 class="title">
<a name="id4785293" id="id4785293"></a>Strategy 2: moveStep
</h3>
</div>
<p>
When task can be divided in many part (knew at runtime) as pear logo
example, the right strategy is : <span class=
"emphasis"><em>moveStep</em></span>.
</p>
<p>
What you must do:
</p>
<div class="orderedlist">
<ol type="1">
<li>compute the right increment : <code class="literal">progress
meter max value / task count</code> This number should be integer,
and round fractions up.
</li>
<li>ALWAYS return the next step value in a user callback or user
function (depending on <a href="ch05s02.html" title="Processing ">
processing strategy</a> used).
</li>
<li>use only <code class="methodname">moveStep()</code> method to
refresh progress meter.
</li>
</ol>
</div>
</div>
</div>
<table class="progress2Footer">
<tr>
<td align="left">
HTML_Progress2 : The Definitive Guide
</td>
<td align="right">
v 2.4.0 : April 20, 2007
</td>
</tr>
</table>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="ch05s02.html">Prev</a>
</td>
<td width="20%" align="center">
<a accesskey="u" href="ch05.html">Up</a>
</td>
<td width="40%" align="right">
<a accesskey="n" href="ch06.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">
Processing
</td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top">
Chapter 6. Indeterminate Mode
</td>
</tr>
</table>
</div>
</body>
</html>