From 3751bed4e3b40adb98949b85b47daf2cfaac29db Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 14 Dec 2005 18:52:04 +0000 Subject: Added TDataBoundControl, TDropDownList and TListBox. Note, they're not done yet. --- framework/Web/UI/WebControls/TListBox.php | 86 +++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 framework/Web/UI/WebControls/TListBox.php (limited to 'framework/Web/UI/WebControls/TListBox.php') diff --git a/framework/Web/UI/WebControls/TListBox.php b/framework/Web/UI/WebControls/TListBox.php new file mode 100644 index 00000000..79afc133 --- /dev/null +++ b/framework/Web/UI/WebControls/TListBox.php @@ -0,0 +1,86 @@ +getRows(); + $writer->addAttribute('size',"$rows"); + $writer->addAttribute('name',$this->getUniqueID()); + parent::addAttributesToRender($writer); + } + + protected function onPreRender($param) + { + parent::onPreRender($param); + if($this->getSelectionMode()==='Multiple' && $this->getEnabled(true)) + $this->getPage()->registerRequiresPostData($this); + } + + public function loadPostData($key,$values) + { + if(!$this->getEnabled(true)) + return false; + // ensure DataBound??? + } + + public function raisePostDataChangedEvent() + { + $page=$this->getPage(); + if($this->getAutoPostBack() && !$page->getPostBackEventTarget()) + { + $page->setPostBackEventTarget($this); + if($this->getCausesValidation()) + $page->validate($this->getValidationGroup()); + } + $this->onSelectedIndexChanged(null); + } + + protected function getIsMultiSelect() + { + return $this->getSelectionMode()==='Multiple'; + } + + public function getSelectedIndices() + { + return parent::getSelectedIndices(); + } + + /** + * @return integer the number of rows to be displayed in the component + */ + public function getRows() + { + return $this->getViewState('Rows', 4); + } + + /** + * Sets the number of rows to be displayed in the component + * @param integer the number of rows + */ + public function setRows($value) + { + $value=TPropertyValue::ensureInteger($value); + if($value<=0) + $value=4; + $this->setViewState('Rows', $value, 4); + } + + /** + * @return string the selection mode (Single, Multiple ) + */ + public function getSelectionMode() + { + return $this->getViewState('SelectionMode', 'Single'); + } + + /** + * Sets the selection mode of the component (Single, Multiple) + * @param string the selection mode + */ + function setSelectionMode($value) + { + $this->setViewState('SelectionMode',TPropertyValue::ensureEnum($value,array('Single','Multiple')),'Single'); + } +} +?> \ No newline at end of file -- cgit v1.2.3