From 94e49ca4633600269831c4e80af25ddcfa3a8258 Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 29 Dec 2005 19:58:07 +0000 Subject: Added TTextBox demos. --- framework/Web/UI/WebControls/TStyle.php | 2 +- framework/Web/UI/WebControls/TTextBox.php | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'framework/Web') diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php index bb1d733a..02f0de29 100644 --- a/framework/Web/UI/WebControls/TStyle.php +++ b/framework/Web/UI/WebControls/TStyle.php @@ -296,7 +296,7 @@ class TStyle extends TComponent { $arr=explode(':',$style); if(isset($arr[1]) && trim($arr[0])!=='') - $writer->addStyleAttribute(trim($arr[0]),trim($arry[1])); + $writer->addStyleAttribute(trim($arr[0]),trim($arr[1])); } } foreach($this->_data as $name=>$value) diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php index 905cc1e1..00d75e75 100644 --- a/framework/Web/UI/WebControls/TTextBox.php +++ b/framework/Web/UI/WebControls/TTextBox.php @@ -42,6 +42,14 @@ */ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable { + /** + * Default number of rows (for MultiLine text box) + */ + const DEFAULT_ROWS=4; + /** + * Default number of columns (for MultiLine text box) + */ + const DEFAULT_COLUMNS=20; /** * @var array list of auto complete types */ @@ -69,9 +77,9 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable if(($textMode=$this->getTextMode())==='MultiLine') { if(($rows=$this->getRows())<=0) - $rows=2; + $rows=self::DEFAULT_ROWS; if(($cols=$this->getColumns())<=0) - $cols=20; + $cols=self::DEFAULT_COLUMNS; $writer->addAttribute('rows',"$rows"); $writer->addAttribute('cols',"$cols"); if(!$this->getWrap()) @@ -119,6 +127,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable $writer->addAttribute('disabled','disabled'); if($this->getAutoPostBack() && $page->getClientSupportsJavaScript()) { + $writer->addAttribute('id',$this->getClientID()); $options = $this->getAutoPostBackOptions(); $scripts = $this->getPage()->getClientScript(); $postback = $scripts->getPostBackEventReference($this,'',$options,false); @@ -337,16 +346,16 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable */ public function getRows() { - return $this->getViewState('Rows',0); + return $this->getViewState('Rows',self::DEFAULT_ROWS); } /** * Sets the number of rows displayed in a multiline text box. - * @param integer the number of rows, set it 0 to clear the setting + * @param integer the number of rows */ public function setRows($value) { - $this->setViewState('Rows',TPropertyValue::ensureInteger($value),0); + $this->setViewState('Rows',TPropertyValue::ensureInteger($value),self::DEFAULT_ROWS); } /** -- cgit v1.2.3