home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / progress.setstringpainted.cls < prev    next >
Encoding:
Text File  |  2004-03-24  |  3.6 KB  |  127 lines

  1. <refentry id="{@id}">
  2.  <refnamediv>
  3.   <refname>setStringPainted Manual</refname>
  4.   <refpurpose>determines whether the progress bar should render a progress string</refpurpose>
  5.  </refnamediv>
  6.  <refsynopsisdiv>
  7.   <refsynopsisdivinfo>
  8.    <author>
  9.     by Laurent Laville
  10.     <authorblurb>{@link mailto:pear@laurent-laville.org}</authorblurb>
  11.    </author>
  12.    <copyright>November 2003, Laurent Laville</copyright>
  13.    <releaseinfo>HTML_Progress 1.0+</releaseinfo>
  14.   </refsynopsisdivinfo>
  15.  </refsynopsisdiv>
  16.  <refsect1 id="{@id synopsis}">
  17.   <title>Synopsis</title>
  18.   <para><emphasis>void</emphasis> <important>setStringPainted</important>( $paint )</para>
  19.  </refsect1>
  20.  <refsect1 id="{@id attributes}">
  21.   <title>Attributes</title>
  22.   <para>
  23.    <table frame="all">
  24.     <tgroup cols="3">
  25.     <thead align="center">
  26.       <row>
  27.        <entry><important>Name</important></entry>
  28.        <entry><important>Type</important></entry>
  29.        <entry><important>Default</important></entry>
  30.       </row>
  31.     </thead>
  32.     <tbody>
  33.      <row>
  34.       <entry><emphasis>paint</emphasis> </entry>
  35.       <entry>boolean                    </entry>
  36.       <entry>false | [ true ]           </entry>
  37.      </row>
  38.     </tbody>
  39.     </tgroup>
  40.    </table>
  41.   </para>
  42.  </refsect1>
  43.  <refsect1 id="{@id description}">
  44.   <title>Description</title>
  45.   <para>The <emphasis>setStringPainted()</emphasis> method is used to decide whether 
  46.    the progress bar should paint its string or not. The default value is false: 
  47.    the progress bar displays the value returned by {@link HTML_Progress::getPercentComplete()}
  48.    method formatted as a percent such as 33%.
  49.   </para>
  50.  </refsect1>
  51.  <refsect1 id="{@id example}">
  52.   <title>Example</title>
  53.   <para>
  54.    Example below will produced a progress bar with a custom string. It's a dynamic example, 
  55.    the progress bar will run.
  56.    <para><graphic fileref="../media/screenshots/string.png"></graphic></para>
  57.    <programlisting role="php">
  58.    <![CDATA[
  59. <?php 
  60. require_once ('HTML/Progress.php');
  61.  
  62. $bar = new HTML_Progress();
  63. $bar->setIncrement(5);
  64. $bar->setStringPainted(true);          // get space for the string
  65. $bar->setString('');                   // but don't paint it
  66.  
  67. $ui =& $bar->getUI();
  68. $ui->setStringAttributes('width=350 align=left');
  69.  
  70. ?>
  71. <!DOCTYPE html
  72.     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  73.     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  74.  
  75. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  76. <head>
  77. <title>Horizontal String ProgressBar example</title>
  78. <style type="text/css">
  79. <!--
  80. <?php echo $bar->getStyle(); ?>
  81. // -->
  82. </style>
  83. <script type="text/javascript">
  84. <!--
  85. <?php echo $ui->getScript(); ?>
  86. //-->
  87. </script>
  88. </head>
  89. <body>
  90.  
  91. <?php 
  92. echo $bar->toHtml(); 
  93.  
  94. $pkg = array('PEAR', 'Archive_Tar', 'Config', 
  95.     'HTML_QuickForm', 'HTML_CSS', 'HTML_Page', 'HTML_Template_Sigma', 
  96.     'Log', 'MDB', 'PHPUnit');
  97.  
  98. do {
  99.     $val = $bar->getValue();
  100.     $i = floor($val / 10);
  101.     $msg = ($val == 100) ? '' : "  installing package ($val %) ... : ".$pkg[$i];
  102.     $bar->setString($msg);
  103.  
  104.     $bar->display();
  105.     if ($bar->getPercentComplete() == 1) {
  106.         break;   // the progress bar has reached 100%
  107.     }
  108.     $bar->incValue();
  109. } while(1);
  110. ?>
  111.  
  112. </body>
  113. </html>
  114.    ]]>
  115.    </programlisting>
  116.   </para>
  117.  </refsect1>
  118.  <refsect1 id="{@id seealso}">
  119.   <title>See Also</title>
  120.   <para>
  121.    Take care that <emphasis>setStringPainted()</emphasis> method is not enough to display
  122.    a custom string. You should also set the value of this custom string. To do it see
  123.    {@tutorial progress.setstring.cls}.
  124.   </para>
  125.  </refsect1>
  126. </refentry>
  127.