## Class TSlider

Description

Implements interfaces:

- IPostBackDataHandler
- IDataRenderer

TSlider class

TSlider displays a slider for numeric input purpose. A slider consists of a 'track', which define the range of possible value, and a 'handle' which can slide on the track, to select a value in the range. The track can be either Horizontal or Vertical, depending of the SetDirection property. By default, it's horizontal.

The range boundaries are defined by SetMinValue and SetMaxValue properties. The default range is from 0 to 100. The SetStepSize property can be used to define the step between 2 values inside the range. Notice that this step will be recomputed if there is more than 200 values between the range boundaries. You can also provide the allowed values by setting the SetValues array.

A 'Progress Indicator' can be displayed within the track with the SetProgressIndicator property.

The TSlider control can be easily customized using CssClasses. You can provide your own css file, using the SetCssUrl property. The css class for TSlider can be set by the CssClass property. Default value is "Slider HorizontalSlider" for an horizontal slider, and "Slider VerticalSlider" for a vertical one.

If SetAutoPostBack property is true, postback is sent as soon as the value changed.

TSlider raises the onValueChanged event when the value of the slider has changed during postback.

You can also attach ClientSide javascript events handler to the slider :

- ClientSide.onSlide is called when the handle is slided on the track. You can get the current value in the value

javascript variable. You can use this event to update on client side a label with the current value

- ClientSide.onChange is called when the slider value has changed (at the end of a move).

- since: 3.1.1
- version: $Id: TSlider.php 2564 2008-11-11 21:56:02Z carlgmathisen $
- author: Christophe Boulain <Christophe.Boulain@gmail.com>

Located in /Web/UI/WebControls/TSlider.php (line 49)

    TComponent
       |
       --TApplicationComponent
          |
          --TControl
             |
             --TWebControl
                |
                --TSlider

Class Constant Summary
MAX_STEPS = 200
Method Summary
void addAttributesToRender (THtmlWriter $writer)
TSliderClientScript createClientScript ()
boolean getAutoPostBack ()
string getClientClassName ()
TSliderClientScript getClientSide ()
string getCssUrl ()
string getData ()
boolean getDataChanged ()
TSliderDirection getDirection ()
float getMaxValue ()
float getMinValue ()
boolean getProgressIndicator ()
array getSliderOptions ()
float getStepSize ()
string getTagName ()
float getValue ()
array getValues ()
boolean loadPostData (string $key, array $values)
void onPreRender (mixed $param)
void onValueChanged (TEventParameter $param)
void raisePostDataChangedEvent ()
void registerSliderClientScript ()
void registerStyleSheet ()
void renderContents (mixed $writer)
void setAutoPostBack (boolean $value)
void setCssUrl (string $value)
void setData (string $value)
void setDirection (TSliderDirection $value)
void setMaxValue (float $value)
void setMinValue (float $value)
void setProgressIndicator (boolean $value)
void setStepSize (float $value)
void setValue (float $value)
void setValues (array $value)
Methods
addAttributesToRender (line 345)

Add the specified css classes to the track

- access: protected

void addAttributesToRender (THtmlWriter $writer)

- THtmlWriter $writer: writer

Redefinition of:

TWebControl::addAttributesToRender()
  Adds attribute name-value pairs to renderer.

createClientScript (line 328)

- return: javascript event options.
- access: protected

TSliderClientScript createClientScript ()
getAutoPostBack (line 227)

- return: a value indicating whether an automatic postback to the server will occur whenever the user modifies the slider value. Defaults to false.
- access: public

boolean getAutoPostBack ()
getClientClassName (line 248)

Gets the name of the javascript class responsible for performing postback for this control.

This method overrides the parent implementation.

- return: the javascript class name
- access: protected

string getClientClassName ()
getClientSide (line 318)

Gets the TSliderClientScript to set the TSlider event handlers.

The slider on the client-side supports the following events.

- <tt>OnSliderMove</tt> -- raised when the slider is moved.
- <tt>OnSliderChanged</tt> -- raised when the slider value is changed

You can attach custom javascript code to each of these events

- return: javascript validator event options.
- access: public

TSliderClientScript getClientSide ()
getCssUrl (line 84)

- return: URL for the CSS file including all relevant CSS class definitions. Defaults to '' (a default CSS file will be applied in this case.)
- access: public

string getCssUrl ()
getData (line 187)

Returns the value of the TSlider control.

This method is required by IDataRenderer. It is the same as getValue().

- return: the value of the TSlider control.
- access: public
- see: TSlider::getValue()

string getData ()
getDataChanged (line 258)

Returns a value indicating whether postback has caused the control data change.

This method is required by the IPostBackDataHandler interface.

- return: whether postback has caused the control data change. False if the page is not in postback mode.
- access: public

boolean getDataChanged ()
getDirection (line 68)

- return: Direction of slider (Horizontal or Vertical). Defaults to Horizontal.
- access: public

TSliderDirection getDirection ()
getMaxValue (line 100)

- return: Maximum value for the slider. Defaults to 100.0.
- access: public

float getMaxValue ()
getMinValue (line 116)

- return: Minimum value for slider. Defaults to 0.0.
- access: public

float getMinValue ()
getProgressIndicator (line 152)

- return: wether to display a progress indicator or not. Defaults to true.
- access: public

boolean getProgressIndicator ()
getSliderOptions (line 447)

Get javascript sliderr options.

- return: slider client-side options
- access: protected

array getSliderOptions ()
getStepSize (line 132)

- return: Step size. Defaults to 1.0.
- access: public

float getStepSize ()
getTagName (line 336)

- return: the HTML tag name for slider. Defaults to div.
- access: public

string getTagName ()

Redefinition of:

TWebControl::getTagName()
  Returns the tag name used for this control.

getValue (line 167)

- return: current value of slider
- access: public

float getValue ()
getValues (line 207)

- return: list of allowed values the slider can take. Defaults to an empty array.
- access: public

array getValues ()
loadPostData (line 295)

Loads user input data.

This method is primarly used by framework developers.

- return: whether the data of the component has been changed
- access: public

boolean loadPostData (string $key, array $values)

- string $key: the key that can be used to retrieve data from the input data collection
- array $values: the input data collection

onPreRender (line 404)

Registers CSS and JS.

This method is invoked right before the control rendering, if the control is visible.

- access: public

void onPreRender (mixed $param)

- mixed $param: event parameter

Redefinition of:

TControl::onPreRender()
  This method is invoked when the control enters 'OnPreRender' stage.

onValueChanged (line 283)

Raises OnValueChanged event.

This method is invoked when the Value property changes on postback. If you override this method, be sure to call the parent implementation to ensure the invocation of the attached event handlers.

- access: public

void onValueChanged (TEventParameter $param)

- TEventParameter $param: event parameter to be passed to the event handlers

raisePostDataChangedEvent (line 270)

Raises postdata changed event.

This method is required by IPostBackDataHandler interface. It is invoked by the framework when Value property is changed on postback. This method is primarly used by framework developers.

- access: public

void raisePostDataChangedEvent ()
registerSliderClientScript (line 432)

Registers the javascript code to initialize the slider.

- access: protected

void registerSliderClientScript ()
registerStyleSheet (line 417)

Registers the CSS relevant to the TSlider.

It will register the CSS file specified by CssUrl. If that is not set, it will use the default CSS.

- access: protected

void registerStyleSheet ()
renderContents (line 360)

Render the body content

- access: public

void renderContents (mixed $writer)

Redefinition of:

TWebControl::renderContents()
  Renders the body content enclosed between the control tag.

setAutoPostBack (line 238)

Sets the value indicating if postback automatically.

An automatic postback to the server will occur whenever the user modifies the slider value.

- access: public

void setAutoPostBack (boolean $value)

- boolean $value: the value indicating if postback automatically

setCssUrl (line 92)

- access: public

void setCssUrl (string $value)

- string $value: URL for the CSS file including all relevant CSS class definitions.

setData (line 199)

Sets the value of the TSlider control.

This method is required by IDataRenderer. It is the same as setValue().

- access: public
- see: TSlider::setValue()

void setData (string $value)

- string $value: the value of the TSlider control.

setDirection (line 76)

- access: public

void setDirection (TSliderDirection $value)

- TSliderDirection $value: Direction of slider (Horizontal or Vertical)

setMaxValue (line 108)

- access: public

void setMaxValue (float $value)

- float $value: Maximum value for slider

setMinValue (line 124)

- access: public

void setMinValue (float $value)

- float $value: Minimum value for slider

setProgressIndicator (line 160)

- access: public

void setProgressIndicator (boolean $value)

- boolean $value: wether to display a progress indicator or not. Defaults to true.

setStepSize (line 144)

Sets the step size used to determine the places where the slider handle can stop at.

An evenly distributed stop marks will be generated according to MinValue, MaxValue and StepSize. To use uneven stop marks, set Values.

- access: public

void setStepSize (float $value)

- float $value: Step size.

setValue (line 175)

- access: public

void setValue (float $value)

- float $value: current value of slider

setValues (line 218)

Sets the possible values that the slider can take.

If this is set, StepSize will be ignored. The latter generates a set of evenly distributed candidate values.

- access: public

void setValues (array $value)

- array $value: list of allowed values the slider can take

#### Inherited Methods

Inherited From TWebControl

> TWebControl::addAttributesToRender()
> TWebControl::clearStyle()
> TWebControl::copyBaseAttributes()
> TWebControl::createStyle()
> TWebControl::getAccessKey()
> TWebControl::getBackColor()
> TWebControl::getBorderColor()
> TWebControl::getBorderStyle()
> TWebControl::getBorderWidth()
> TWebControl::getCssClass()
> TWebControl::getDisplay()
> TWebControl::getFont()
> TWebControl::getForeColor()
> TWebControl::getHasStyle()
> TWebControl::getHeight()
> TWebControl::getStyle()
> TWebControl::getTabIndex()
> TWebControl::getTagName()
> TWebControl::getToolTip()
> TWebControl::getWidth()
> TWebControl::render()
> TWebControl::renderBeginTag()
> TWebControl::renderContents()
> TWebControl::renderEndTag()
> TWebControl::setAccessKey()
> TWebControl::setBackColor()
> TWebControl::setBorderColor()
> TWebControl::setBorderStyle()
> TWebControl::setBorderWidth()
> TWebControl::setCssClass()
> TWebControl::setDisplay()
> TWebControl::setForeColor()
> TWebControl::setHeight()
> TWebControl::setStyle()
> TWebControl::setTabIndex()
> TWebControl::setToolTip()
> TWebControl::setWidth()

Inherited From TControl

> TControl::__construct()
> TControl::addedControl()
> TControl::addParsedObject()
> TControl::addToPostDataLoader()
> TControl::applyStyleSheetSkin()
> TControl::autoBindProperty()
> TControl::autoDataBindProperties()
> TControl::bindProperty()
> TControl::broadcastEvent()
> TControl::bubbleEvent()
> TControl::clearChildState()
> TControl::clearControlState()
> TControl::clearNamingContainer()
> TControl::clearViewState()
> TControl::convertUniqueIdToClientId()
> TControl::createChildControls()
> TControl::createControlCollection()
> TControl::dataBind()
> TControl::dataBindChildren()
> TControl::dataBindProperties()
> TControl::ensureChildControls()
> TControl::findControl()
> TControl::findControlsByID()
> TControl::findControlsByType()
> TControl::focus()
> TControl::getAdapter()
> TControl::getAllowChildControls()
> TControl::getAttribute()
> TControl::getAttributes()
> TControl::getChildControlsCreated()
> TControl::getClientID()
> TControl::getControls()
> TControl::getControlStage()
> TControl::getControlState()
> TControl::getCustomData()
> TControl::getEnabled()
> TControl::getEnableTheming()
> TControl::getEnableViewState()
> TControl::getHasAdapter()
> TControl::getHasAttributes()
> TControl::getHasChildInitialized()
> TControl::getHasControls()
> TControl::getHasInitialized()
> TControl::getHasLoaded()
> TControl::getHasLoadedPostData()
> TControl::getHasPreRendered()
> TControl::getID()
> TControl::getNamingContainer()
> TControl::getPage()
> TControl::getParent()
> TControl::getRegisteredObject()
> TControl::getSkinID()
> TControl::getSourceTemplateControl()
> TControl::getTemplateControl()
> TControl::getUniqueID()
> TControl::getViewState()
> TControl::getVisible()
> TControl::hasAttribute()
> TControl::initRecursive()
> TControl::isDescendentOf()
> TControl::isObjectRegistered()
> TControl::loadRecursive()
> TControl::loadState()
> TControl::loadStateRecursive()
> TControl::onDataBinding()
> TControl::onInit()
> TControl::onLoad()
> TControl::onPreRender()
> TControl::onUnload()
> TControl::preRenderRecursive()
> TControl::raiseBubbleEvent()
> TControl::registerObject()
> TControl::removeAttribute()
> TControl::removedControl()
> TControl::render()
> TControl::renderChildren()
> TControl::renderControl()
> TControl::saveState()
> TControl::saveStateRecursive()
> TControl::setAdapter()
> TControl::setAttribute()
> TControl::setChildControlsCreated()
> TControl::setControlStage()
> TControl::setControlState()
> TControl::setCustomData()
> TControl::setEnabled()
> TControl::setEnableTheming()
> TControl::setEnableViewState()
> TControl::setID()
> TControl::setPage()
> TControl::setSkinID()
> TControl::setTemplateControl()
> TControl::setViewState()
> TControl::setVisible()
> TControl::trackViewState()
> TControl::traverseChildControls()
> TControl::unbindProperty()
> TControl::unloadRecursive()
> TControl::unregisterObject()
> TControl::__get()

Inherited From TApplicationComponent

> TApplicationComponent::getApplication()
> TApplicationComponent::getRequest()
> TApplicationComponent::getResponse()
> TApplicationComponent::getService()
> TApplicationComponent::getSession()
> TApplicationComponent::getUser()
> TApplicationComponent::publishAsset()
> TApplicationComponent::publishFilePath()

Inherited From TComponent

> TComponent::addParsedObject()
> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::createdOnTemplate()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Class Constants
MAX_STEPS = 200 (line 51)

#### Inherited Constants

Inherited from TControl

> TControl::AUTOMATIC_ID_PREFIX
> TControl::CLIENT_ID_SEPARATOR
> TControl::CS_CHILD_INITIALIZED
> TControl::CS_CONSTRUCTED
> TControl::CS_INITIALIZED
> TControl::CS_LOADED
> TControl::CS_PRERENDERED
> TControl::CS_STATE_LOADED
> TControl::ID_FORMAT
> TControl::ID_SEPARATOR
> TControl::IS_CHILD_CREATED
> TControl::IS_CREATING_CHILD
> TControl::IS_DISABLE_THEMING
> TControl::IS_DISABLE_VIEWSTATE
> TControl::IS_ID_SET
> TControl::IS_SKIN_APPLIED
> TControl::IS_STYLESHEET_APPLIED
> TControl::RF_ADAPTER
> TControl::RF_AUTO_BINDINGS
> TControl::RF_CHILD_STATE
> TControl::RF_CONTROLS
> TControl::RF_CONTROLSTATE
> TControl::RF_DATA_BINDINGS
> TControl::RF_EVENTS
> TControl::RF_NAMED_CONTROLS
> TControl::RF_NAMED_CONTROLS_ID
> TControl::RF_NAMED_OBJECTS
> TControl::RF_SKIN_ID

Documentation generated on Mon, 22 Feb 2010 12:18:38 +0000 by phpDocumentor 1.3.0RC4