From ad678bcd067deafcaa9984b179471fd980465cd8 Mon Sep 17 00:00:00 2001 From: "ctrlaltca@gmail.com" <> Date: Fri, 21 Oct 2011 09:06:19 +0000 Subject: fixes #368 + documentation-only addition to TDropDownList, other changes are due to line ending --- framework/Web/UI/WebControls/TDropDownList.php | 44 +++++++++++++++----------- 1 file changed, 25 insertions(+), 19 deletions(-) (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 abd1bca5..f66daaf7 100644 --- a/framework/Web/UI/WebControls/TDropDownList.php +++ b/framework/Web/UI/WebControls/TDropDownList.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2011 PradoSoft + * @copyright Copyright © 2005-2011 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -32,6 +32,12 @@ Prado::using('System.Web.UI.WebControls.TListControl'); * displayed as the first list item by specifying either {@link setPromptText PromptText} or * {@link setPromptValue PromptValue}, or both. Choosing the prompt item will unselect the TDropDownList. * + * When a prompt item is set, its index in the list is set to -1. So, the {@link getSelectedIndex SelectedIndex} + * property is not affected by a prompt item: the items list will still be zero-based. + * + * The {@link clearSelection clearSelection} method will select the prompt item if existing, otherway the first + * available item in the dropdown list will be selected. + * * @author Qiang Xue * @version $Id$ * @package System.Web.UI.WebControls @@ -40,7 +46,7 @@ Prado::using('System.Web.UI.WebControls.TListControl'); class TDropDownList extends TListControl implements IPostBackDataHandler, IValidatable { private $_dataChanged=false; - private $_isValid=true; + private $_isValid=true; /** * Adds attributes to renderer. @@ -128,21 +134,21 @@ class TDropDownList extends TListControl implements IPostBackDataHandler, IValid { return $this->getSelectedValue(); } - - /** - * Returns true if this control validated successfully. - * Defaults to true. - * @return bool wether this control validated successfully. - */ - public function getIsValid() - { - return $this->_isValid; - } - /** - * @param bool wether this control is valid. - */ - public function setIsValid($value) - { - $this->_isValid=TPropertyValue::ensureBoolean($value); - } + + /** + * Returns true if this control validated successfully. + * Defaults to true. + * @return bool wether this control validated successfully. + */ + public function getIsValid() + { + return $this->_isValid; + } + /** + * @param bool wether this control is valid. + */ + public function setIsValid($value) + { + $this->_isValid=TPropertyValue::ensureBoolean($value); + } } -- cgit v1.2.3