Changeset 2194

Show
Ignore:
Timestamp:
09/03/2007 11:15:31 AM (15 months ago)
Author:
tof
Message:

Add Quickstart TSlider description and example

Location:
branches/3.2-dev/demos/quickstart/protected/pages/Controls
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/3.2-dev/demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.page

    • Property svn:keywords set to Id
    r2190 r2194  
    11<com:TContent id="body"> 
    22<h1>TSlider Sample</h1> 
    3 <p>Description here</p> 
    43 
    5 <p>Horizontal slider, with image handle, Javascript 'onSlide' handler, ServerSide 'onSliderChanged' handler and autopostback=true</p> 
    6 <com:TSlider id="hSlider" AutoPostBack="true" Handle.CssClass="handle-image" Direction="Horizontal" Enabled="true" MinValue="0" MaxValue="1" StepSize="0.1" OnValueChanged="sliderChanged"> 
     4<table class="sampletable"> 
     5 
     6<tr><td class="samplenote"> 
     7Simple horizontal slider, with no events handler attached</td><td class="sampleaction"> 
     8<com:TSlider id="slider1" Direction="Horizontal"/> 
     9</td> 
     10<td class="sampleaction"> 
     11        <com:TButton onClick="submit1" Text="Submit"/> 
     12        <com:TLabel id="slider1Result"/> 
     13</td></tr> 
     14<tr><td class="samplenote"> 
     15Horizontal slider from -50 to 50, with image handle, Javascript 'onSlide' handler, ServerSide 'onSliderChanged' handler, initial value and autopostback=true 
     16</td><td class="sampleaction"> 
     17<com:TSlider id="slider2" AutoPostBack="true" Handle.CssClass="handle-image" Direction="Horizontal" Value="30" Enabled="true" MinValue="-50" MaxValue="50" OnValueChanged="slider2Changed"> 
    718        <prop:ClientSide.onSlide> 
    8                 $('hslidervalue').innerHTML = value; 
     19                $('slider2value').innerHTML = value; 
    920        </prop:ClientSide.onSlide> 
    1021</com:TSlider> 
    11  Value  : <span id="hslidervalue"><%=$this->hSlider->value%></span> 
    12 <br/><br/> 
    13 <p> 
    14 Vertical slider, cursor handle, no auto postback, no event handler 
    15 </p> 
    16 <com:TSlider id="vSlider" Direction="Vertical" Enabled="true" Values="(-2,-1,0,1,6,2,7,3,4,5)" /> 
    17  <com:TButton onclick="testsubmit" text="Submit"/> 
    18  
    19 <br/> 
    20 <com:TSlider StepSize="0.1"/> 
    21 <p> 
    22 Results :<br/> 
    23 Horizontal Slider value : <com:TLabel id="hSliderResult"/><br/> 
    24 Vertical Slider value : <com:TLabel id="vSliderResult"/> 
    25 </p> 
     22Value  : <span id="slider2value"><%=$this->slider2->value%></span> 
     23</td><td class="sampleaction"> 
     24<com:TLabel id="slider2Result"/> 
     25</td></tr> 
     26<tr><td class="samplenote"> 
     27Vertical slider from 0 to 1, with image handle, Javascript 'onSlide' handler, ServerSide 'onSliderChanged' handler, StepSize, and no autopostback 
     28</td><td class="sampleaction"> 
     29<com:TSlider id="slider3" AutoPostBack="false" Handle.CssClass="handle-image" Direction="Vertical" Enabled="true" MinValue="0" MaxValue="1" StepSize="0.1" OnValueChanged="slider3Changed"> 
     30        <prop:ClientSide.onSlide> 
     31                $('slider3value').innerHTML = value; 
     32        </prop:ClientSide.onSlide> 
     33</com:TSlider> 
     34Value  : <span id="slider3value"><%=$this->slider3->value%></span> 
     35</td><td class="sampleaction"> 
     36<com:TButton Text="Submit"/> 
     37<com:TLabel id="slider3Result"/> 
     38</td></tr> 
     39</table> 
    2640</com:TContent> 
  • branches/3.2-dev/demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.php

    r2188 r2194  
    22class Home extends TPage  
    33{ 
    4         public function testsubmit ($sender, $param) 
     4        public function submit1 ($sender, $param) 
    55        { 
    6                 $this->hSliderResult->setText('submit : '.$this->hSlider->getValue());   
    7                 $this->vSliderResult->setText('submit : '.$this->vSlider->getValue()); 
     6                $this->slider1Result->setText('Slider Value : '.$this->slider1->getValue());     
    87        } 
    98         
    10         public function sliderChanged ($sender, $param) 
     9        public function slider2Changed ($sender, $param) 
    1110        { 
    12                 $this->hSliderResult->setText('onSliderChanged : '.$sender->getValue()); 
     11                $this->slider2Result->setText('onSliderChanged, Value : '.$sender->getValue()); 
     12        } 
     13         
     14        public function slider3Changed ($sender, $param) 
     15        { 
     16                $this->slider3Result->setText('onSliderChanged, Value : '.$sender->getValue()); 
    1317        } 
    1418} 
  • branches/3.2-dev/demos/quickstart/protected/pages/Controls/Slider.page

    • Property svn:keywords set to Id
    r2188 r2194  
    55 
    66<p id="510314" class="block-content"> 
    7 <tt>TSlider</tt> displays a slider on a page 
     7<tt>TSlider</tt> displays a slider for numeric input purpose. A slider consists of a <em>track</em>  
     8which define the range of possible value, and a <em>handle</em> which can slide on the track, to select  
     9a value in the range. The track can be either Horizontal or Vertical, depending of the <tt>Direction</tt> 
     10property. By default, it's horizontal. 
     11</p> 
     12<p> 
     13The range boundaries are defined by <tt> MinValue</tt> and <tt>MaxValue</tt> properties.  
     14The default range is from 0 to 100.  
     15The <tt>StepSize</tt> property can be used to define the <em>step</em> between 2 values inside the range. 
     16Notice that this step will be recomputed if there is more than 200 values between the range boundaries. 
     17You can also provide the allowed values by setting the <tt>Values</tt> array. 
    818</p> 
    919 
    10 <p>To be continued...</p> 
     20<p> 
     21The handle sub-properties can be accessed by <tt>Handle</tt> property. You can also provide your own control 
     22for the handle, using <tt>HandleClass</tt> property. Note that this class must be a subclass of  
     23<tt>TSliderHandle</tt> 
     24</p> 
     25 
     26<p> 
     27The TSlider control can be easily customized using CssClasses. You can provide your own css file, using the  
     28<tt>CssUrl</tt> property. 
     29The css class for TSlider can be set by the <tt>CssClass</tt> property. Defaults values are <b>'hslider'</b> for 
     30an Horizontal slider, or <b>'vslider'</b> for a Vertical one.  
     31The css class for the Handle can be set by the <tt>Handle.CssClass</tt> subproperty. Defaults is <b>'handle'</b>, which just 
     32draw a red block as a cursor. <b>'handle-image'</b> css class is also provided for your convenience, which display an image 
     33as the handle. 
     34</p> 
     35 
     36<p> 
     37If <tt>AutoPostBack</tt> property is true, postback is performed as soon as the value changed. 
     38</p> 
     39 
     40<p> 
     41TSlider raises the <tt>onValueChanged</tt> event when the value of the slider has changed during postback. 
     42</p> 
     43 
     44<p> 
     45You can also attach ClientSide javascript events handler to the slider : 
     46<ul> 
     47<li><tt>ClientSide.onSlide</tt> is called when the handle is slided on the track. You can get the current value in the <b>value</b> 
     48javascript variable. You can use this event to update on client side a label with the current value</li> 
     49<li><tt>ClientSide.onChange</tt> is called when the slider value has changed (at the end of a move).</li> 
     50</ul>  
     51</p> 
     52 
    1153<com:RunBar PagePath="Controls.Samples.TSlider.Home" /> 
    1254