Class TSlider
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).
| Constants Inherited From TControl |
|
AUTOMATIC_ID_PREFIX,
CLIENT_ID_SEPARATOR,
CS_CHILD_INITIALIZED,
CS_CONSTRUCTED,
CS_INITIALIZED,
CS_LOADED,
CS_PRERENDERED,
CS_STATE_LOADED,
ID_FORMAT,
ID_SEPARATOR,
IS_CHILD_CREATED,
IS_CREATING_CHILD,
IS_DISABLE_THEMING,
IS_DISABLE_VIEWSTATE,
IS_ID_SET,
IS_SKIN_APPLIED,
IS_STYLESHEET_APPLIED,
RF_ADAPTER,
RF_AUTO_BINDINGS,
RF_CHILD_STATE,
RF_CONTROLS,
RF_CONTROLSTATE,
RF_DATA_BINDINGS,
RF_EVENTS,
RF_NAMED_CONTROLS,
RF_NAMED_CONTROLS_ID,
RF_NAMED_OBJECTS,
RF_SKIN_ID,
|
| Method Summary |
|
protected
void
|
Add the specified css classes to the track
|
|
protected
TSliderClientScript
|
|
|
boolean
|
|
|
protected
string
|
Gets the name of the javascript class responsible for performing postback for this control.
|
|
TSliderClientScript
|
Gets the TSliderClientScript to set the TSlider event handlers.
|
|
string
|
|
|
string
|
Returns the value of the TSlider control.
|
|
boolean
|
Returns a value indicating whether postback has caused the control data change.
|
|
TSliderDirection
|
|
|
float
|
|
|
float
|
|
|
boolean
|
|
|
protected
array
|
Get javascript sliderr options.
|
|
float
|
|
|
string
|
|
|
float
|
|
|
array
|
|
|
boolean
|
Loads user input data.
|
|
void
|
Registers CSS and JS.
|
|
void
|
Raises OnValueChanged event.
|
|
void
|
Raises postdata changed event.
|
|
protected
void
|
Registers the javascript code to initialize the slider.
|
|
protected
void
|
Registers the CSS relevant to the TSlider.
|
|
void
|
Render the body content
|
|
void
|
Sets the value indicating if postback automatically.
|
|
void
|
|
|
void
|
Sets the value of the TSlider control.
|
|
void
|
|
|
void
|
|
|
void
|
|
|
void
|
|
|
void
|
Sets the step size used to determine the places where the slider handle can stop at.
|
|
void
|
|
|
void
|
Sets the possible values that the slider can take.
|
| 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()
|
| Methods Inherited From TControl |
|
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()
|
| Methods 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()
|
| Method Details |
addAttributesToRender
| protected void addAttributesToRender |
(THtmlWriter $writer ) |
Add the specified css classes to the track
|
createClientScript
|
getAutoPostBack
| public boolean getAutoPostBack |
() |
| Output |
|
boolean
| a value indicating whether an automatic postback to the server will occur whenever the user modifies the slider value. Defaults to false. |
| Exception |
|
getClientClassName
| protected string getClientClassName |
() |
Gets the name of the javascript class responsible for performing postback for this control.
This method overrides the parent implementation.
| Output |
|
string
| the javascript class name |
| Exception |
|
getClientSide
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
|
getCssUrl
| public string getCssUrl |
() |
| Output |
|
string
| URL for the CSS file including all relevant CSS class definitions. Defaults to '' (a default CSS file will be applied in this case.) |
| Exception |
|
getData
Returns the value of the TSlider control.
This method is required by IDataRenderer. It is the same as getValue().
| Output |
|
string
| the value of the TSlider control. |
| Exception |
|
getDataChanged
| public boolean getDataChanged |
() |
Returns a value indicating whether postback has caused the control data change.
This method is required by the IPostBackDataHandler interface.
| Output |
|
boolean
| whether postback has caused the control data change. False if the page is not in postback mode. |
| Exception |
|
getDirection
| Output |
|
TSliderDirection
| Direction of slider (Horizontal or Vertical). Defaults to Horizontal. |
| Exception |
|
getMaxValue
| public float getMaxValue |
() |
| Output |
|
float
| Maximum value for the slider. Defaults to 100.0. |
| Exception |
|
getMinValue
| public float getMinValue |
() |
| Output |
|
float
| Minimum value for slider. Defaults to 0.0. |
| Exception |
|
getProgressIndicator
| public boolean getProgressIndicator |
() |
| Output |
|
boolean
| wether to display a progress indicator or not. Defaults to true. |
| Exception |
|
getSliderOptions
| protected array getSliderOptions |
() |
Get javascript sliderr options.
| Output |
|
array
| slider client-side options |
| Exception |
|
getStepSize
| public float getStepSize |
() |
| Output |
|
float
| Step size. Defaults to 1.0. |
| Exception |
|
getTagName
| public string getTagName |
() |
| Output |
|
string
| the HTML tag name for slider. Defaults to div. |
| Exception |
|
getValue
| Output |
|
float
| current value of slider |
| Exception |
|
getValues
| public array getValues |
() |
| Output |
|
array
| list of allowed values the slider can take. Defaults to an empty array. |
| Exception |
|
loadPostData
| public boolean loadPostData |
(string $key , array $values ) |
Loads user input data.
This method is primarly used by framework developers.
| Input |
| string | $key | the key that can be used to retrieve data from the input data collection |
| array | $values | the input data collection |
| Output |
|
boolean
| whether the data of the component has been changed |
| Exception |
|
onPreRender
| public void onPreRender |
(mixed $param ) |
Registers CSS and JS.
This method is invoked right before the control rendering, if the control is visible.
| Input |
| mixed | $param | event parameter |
| Output |
| Exception |
|
onValueChanged
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.
| Input |
| TEventParameter | $param | event parameter to be passed to the event handlers |
| Output |
| Exception |
|
raisePostDataChangedEvent
| public void raisePostDataChangedEvent |
() |
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.
|
registerSliderClientScript
| protected void registerSliderClientScript |
() |
Registers the javascript code to initialize the slider.
|
registerStyleSheet
| protected void registerStyleSheet |
() |
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.
|
renderContents
| public void renderContents |
(mixed $writer ) |
Render the body content
| Input |
| mixed | $writer | |
| Output |
| Exception |
|
setAutoPostBack
| public void setAutoPostBack |
(boolean $value ) |
Sets the value indicating if postback automatically.
An automatic postback to the server will occur whenever the user modifies the slider value.
| Input |
| boolean | $value | the value indicating if postback automatically |
| Output |
| Exception |
|
setCssUrl
| public void setCssUrl |
(string $value ) |
| Input |
| string | $value | URL for the CSS file including all relevant CSS class definitions. |
| Output |
| Exception |
|
setData
| public void setData |
(string $value ) |
Sets the value of the TSlider control.
This method is required by IDataRenderer. It is the same as setValue().
| Input |
| string | $value | the value of the TSlider control. |
| Output |
| Exception |
|
setDirection
| Input |
| TSliderDirection | $value | Direction of slider (Horizontal or Vertical) |
| Output |
| Exception |
|
setMaxValue
| public void setMaxValue |
(float $value ) |
| Input |
| float | $value | Maximum value for slider |
| Output |
| Exception |
|
setMinValue
| public void setMinValue |
(float $value ) |
| Input |
| float | $value | Minimum value for slider |
| Output |
| Exception |
|
setProgressIndicator
| public void setProgressIndicator |
(boolean $value ) |
| Input |
| boolean | $value | wether to display a progress indicator or not. Defaults to true. |
| Output |
| Exception |
|
setStepSize
| public void setStepSize |
(float $value ) |
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.
| Input |
| float | $value | Step size. |
| Output |
| Exception |
|
setValue
| public void setValue |
(float $value ) |
| Input |
| float | $value | current value of slider |
| Output |
| Exception |
|
setValues
| public void setValues |
(array $value ) |
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.
| Input |
| array | $value | list of allowed values the slider can take |
| Output |
| Exception |
|
| Constant Details |
MAX_STEPS
|
|