From d1384deb9b3ac872defd08fd01fbf8cf11442b45 Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 4 Jan 2006 04:59:01 +0000 Subject: Added documentation. --- framework/Web/UI/WebControls/TDropDownList.php | 46 +++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'framework/Web/UI/WebControls/TDropDownList.php') diff --git a/framework/Web/UI/WebControls/TDropDownList.php b/framework/Web/UI/WebControls/TDropDownList.php index 9b9b1b92..d56e3e7e 100644 --- a/framework/Web/UI/WebControls/TDropDownList.php +++ b/framework/Web/UI/WebControls/TDropDownList.php @@ -1,13 +1,45 @@ + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + * @package System.Web.UI.WebControls + */ +/** + * TDropDownList class + * + * TDropDownList displays a dropdown list on a Web page. + * It inherits all properties and events from {@link TListControl}. + * + * @author Qiang Xue + * @version $Revision: $ $Date: $ + * @package System.Web.UI.WebControls + * @since 3.0 + */ class TDropDownList extends TListControl implements IPostBackDataHandler { + /** + * Adds attributes to renderer. + * @param THtmlWriter the renderer + */ protected function addAttributesToRender($writer) { $writer->addAttribute('name',$this->getUniqueID()); parent::addAttributesToRender($writer); } + /** + * Loads user input data. + * This method is primarly used by framework developers. + * @param string the key that can be used to retrieve data from the input data collection + * @param array the input data collection + * @return boolean whether the data of the component has been changed + */ public function loadPostData($key,$values) { if(!$this->getEnabled(true)) @@ -26,6 +58,13 @@ class TDropDownList extends TListControl implements IPostBackDataHandler return false; } + /** + * Raises postdata changed event. + * This method is required by {@link IPostBackDataHandler} interface. + * It is invoked by the framework when {@link getSelectedIndex SelectedIndex} property + * is changed on postback. + * This method is primarly used by framework developers. + */ public function raisePostDataChangedEvent() { $page=$this->getPage(); @@ -38,10 +77,15 @@ class TDropDownList extends TListControl implements IPostBackDataHandler $this->onSelectedIndexChanged(null); } + /** + * @return integer the index (zero-based) of the item being selected. + * If none is selected, the return value is 0 meaning the first item is selected. + * If there is no items, it returns -1. + */ public function getSelectedIndex() { $index=parent::getSelectedIndex(); - if($index<0 && $this->getItems()->getCount()>0) + if($index<0 && $this->getHasItems()) { $this->setSelectedIndex(0); return 0; -- cgit v1.2.3