summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TSlider.php
diff options
context:
space:
mode:
authortof <>2007-09-06 16:32:44 +0000
committertof <>2007-09-06 16:32:44 +0000
commitac19b0fd24b3da09e1d056a1591bcf38dd4d00d2 (patch)
tree88875fec48c4359086dc3d5d88215e7544f3777d /framework/Web/UI/WebControls/TSlider.php
parent5045ce918a502ca934866911ea463b0e61e6a51f (diff)
TSlider: Add handle as a child control instead of just rendering it
Diffstat (limited to 'framework/Web/UI/WebControls/TSlider.php')
-rw-r--r--framework/Web/UI/WebControls/TSlider.php55
1 files changed, 26 insertions, 29 deletions
diff --git a/framework/Web/UI/WebControls/TSlider.php b/framework/Web/UI/WebControls/TSlider.php
index 094dbd5b..7ac8f033 100644
--- a/framework/Web/UI/WebControls/TSlider.php
+++ b/framework/Web/UI/WebControls/TSlider.php
@@ -208,23 +208,32 @@ class TSlider extends TWebControl implements IPostBackDataHandler, IDataRenderer
public function setValues($value)
{
$this->setViewState('Values', TPropertyValue::ensureArray($value), array());
- }
-
- /**
- * @return TSliderHandle the control for the slider's handle.
- */
- public function getHandle ()
- {
- if ($this->_handle==null)
- {
- $this->_handle=prado::createComponent($this->getHandleClass(), $this);
- if (!$this->_handle instanceof TSliderHandle)
- {
- throw new TInvalidDataTypeException('slider_handle_class_invalid', get_class($this->_handle));
- }
- }
- return $this->_handle;
- }
+ }
+
+ /**
+ * Create the child controls
+ * Override parent implementation to create the handle control
+ */
+ public function createChildControls()
+ {
+ $this->_handle=prado::createComponent($this->getHandleClass(), $this);
+ if (!$this->_handle instanceof TSliderHandle)
+ {
+ throw new TInvalidDataTypeException('slider_handle_class_invalid', get_class($this->_handle));
+ }
+ $this->getControls()->add($this->_handle);
+ }
+
+ /**
+ * This method will return the handle control.
+ * @return TSliderHandle the control for the slider's handle (must inherit from TSliderHandle}
+ */
+ public function getHandle ()
+ {
+ $this->ensureChildControls();
+ return $this->_handle;
+ }
+
/**
* @return string Custom handle class. Defaults to TSliderHandle;
@@ -361,18 +370,6 @@ class TSlider extends TWebControl implements IPostBackDataHandler, IDataRenderer
}
/**
- * Renders body content.
- * This method renders the handle of slider
- * This method overrides parent implementation
- * @param THtmlWriter writer
- */
- public function renderContents($writer)
- {
- // Render the handle
- $this->getHandle()->render ($writer);
- }
-
- /**
* Add the specified css classes to the track
* @param THtmlWriter writer
*/