From 94e49ca4633600269831c4e80af25ddcfa3a8258 Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 29 Dec 2005 19:58:07 +0000 Subject: Added TTextBox demos. --- .gitattributes | 2 + .../protected/controls/Highlighter/geshi/prado.php | 21 ++++-- .../protected/pages/Controls/Samples/Label.page | 23 ++++-- .../protected/pages/Controls/Samples/TextBox.page | 81 ++++++++++++++++++++++ .../protected/pages/Controls/Samples/TextBox.php | 16 +++++ .../protected/pages/Controls/Simple.page | 6 ++ .../protected/pages/Fundamentals/Components.page | 2 +- demos/quickstart/themes/Simple/style.css | 7 ++ framework/Web/UI/WebControls/TStyle.php | 2 +- framework/Web/UI/WebControls/TTextBox.php | 19 +++-- 10 files changed, 161 insertions(+), 18 deletions(-) create mode 100644 demos/quickstart/protected/pages/Controls/Samples/TextBox.page create mode 100644 demos/quickstart/protected/pages/Controls/Samples/TextBox.php diff --git a/.gitattributes b/.gitattributes index 01929f48..964bd457 100644 --- a/.gitattributes +++ b/.gitattributes @@ -40,6 +40,8 @@ demos/quickstart/protected/pages/Configurations/Templates3.page -text demos/quickstart/protected/pages/Construction.page -text demos/quickstart/protected/pages/Controls/Overview.page -text demos/quickstart/protected/pages/Controls/Samples/Label.page -text +demos/quickstart/protected/pages/Controls/Samples/TextBox.page -text +demos/quickstart/protected/pages/Controls/Samples/TextBox.php -text demos/quickstart/protected/pages/Controls/Samples/config.xml -text demos/quickstart/protected/pages/Controls/Simple.page -text demos/quickstart/protected/pages/Controls/Simple1.page -text diff --git a/demos/quickstart/protected/controls/Highlighter/geshi/prado.php b/demos/quickstart/protected/controls/Highlighter/geshi/prado.php index 95759a87..c9d96a35 100644 --- a/demos/quickstart/protected/controls/Highlighter/geshi/prado.php +++ b/demos/quickstart/protected/controls/Highlighter/geshi/prado.php @@ -100,26 +100,33 @@ $language_data = array ( ), 'REGEXPS' => array( 0 => array( - GESHI_SEARCH => '((<)(com:)([a-z0-9\\\.]+)(\s*))', - GESHI_REPLACE => '\\2\\3\\4\\5', + GESHI_SEARCH => '<(com:[a-z0-9\\\.]+)', + GESHI_REPLACE => '\\1', GESHI_MODIFIERS => 'i', - GESHI_BEFORE => '', + GESHI_BEFORE => '<', GESHI_AFTER => '' ), 1 => array( - GESHI_SEARCH => '(</com:[a-z0-9\-]+\s*>)', + GESHI_SEARCH => '</(com:[a-z0-9\-]+)', GESHI_REPLACE => '\\1', GESHI_MODIFIERS => 'i', - GESHI_BEFORE => '', + GESHI_BEFORE => '</', GESHI_AFTER => '' ), 2 => array( - GESHI_SEARCH => '(</?prop:?([a-z0-9_]+)>)', + GESHI_SEARCH => '(</?)(prop:[a-z0-9_]+>)', + GESHI_REPLACE => '\\2', + GESHI_MODIFIERS => 'i', + GESHI_BEFORE => '\\1', + GESHI_AFTER => '' + ), + 3 => array( + GESHI_SEARCH => '((/)?>)', GESHI_REPLACE => '\\1', GESHI_MODIFIERS => 'i', GESHI_BEFORE => '', GESHI_AFTER => '' - ), + ) ), 'STRICT_MODE_APPLIES' => GESHI_ALWAYS, 'SCRIPT_DELIMITERS' => array( diff --git a/demos/quickstart/protected/pages/Controls/Samples/Label.page b/demos/quickstart/protected/pages/Controls/Samples/Label.page index 2fa77988..381541a0 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/Label.page +++ b/demos/quickstart/protected/pages/Controls/Samples/Label.page @@ -3,28 +3,43 @@

TLabel Samples

+ +
+ -
- + +
+
- + + This is a label with empty Text property and nonempty body. + +
+ +
+ + +
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TextBox.page b/demos/quickstart/protected/pages/Controls/Samples/TextBox.page new file mode 100644 index 00000000..43ab16f7 --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TextBox.page @@ -0,0 +1,81 @@ + + +

TTextBox Samples

+ +
+
SingleLine and Password Text Boxes
+ +Text box with default settings: + +
+ +Password text box: + +
+ +Text box with customized color, font, columns, maximum length: + +
+ +Disabled text box: + +
+ +Read-only text box: + +
+ +Auto postback text box: + +
+ +Text box's behavior upon postback: + + + +
+ +
+
MultiLine Text Boxes
+ +Text box with default settings:
+ +
+ +Text box with customized dimensions, font and content:
+ + +This is a multiline text box. +In HTML, it is displayed as a textarea. + + +
+ +Disabled text box:
+ +
+ +Read-only text box with text-wrapping disabled:
+ +
+ +Auto postback text box:
+ +
+
+ +
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Samples/TextBox.php b/demos/quickstart/protected/pages/Controls/Samples/TextBox.php new file mode 100644 index 00000000..1e6478de --- /dev/null +++ b/demos/quickstart/protected/pages/Controls/Samples/TextBox.php @@ -0,0 +1,16 @@ +Text="text changed"; + } + + public function submitText($sender,$param) + { + $this->TextBox1->Text="You just entered '".$this->TextBox1->Text."'."; + } +} + +?> \ No newline at end of file diff --git a/demos/quickstart/protected/pages/Controls/Simple.page b/demos/quickstart/protected/pages/Controls/Simple.page index 94061711..5a145102 100644 --- a/demos/quickstart/protected/pages/Controls/Simple.page +++ b/demos/quickstart/protected/pages/Controls/Simple.page @@ -8,4 +8,10 @@

+

TTextBox

+

+TTextBox displays a text box on a Web page. The content in the text box is determined by the Text property. You can create a SingleLine, a MultiLine, or a Password text box by setting the TextMode property. The Rows and Columns properties specify their dimensions. If AutoPostBack is true, changing the content in the text box and then moving the focus out of it will cause postback action. +

+ + \ No newline at end of file diff --git a/demos/quickstart/protected/pages/Fundamentals/Components.page b/demos/quickstart/protected/pages/Fundamentals/Components.page index 56cf1671..32d82e1c 100644 --- a/demos/quickstart/protected/pages/Fundamentals/Components.page +++ b/demos/quickstart/protected/pages/Fundamentals/Components.page @@ -120,7 +120,7 @@ where ComponentType refers to a class name or a type name in namespace

Static Component Instantiation

Static component instantiation is about creating components via configurations. The actual creation work is done by the PRADO framework. For example, in an application configuration, one can configure a module to be loaded when the application runs. The module is thus a static component created by the framework. Static component instantiation is more commonly used in templates. Every component tag in a template specifies a component that will be automatically created by the framework when the template is loaded. For example, in a page template, the following tag will lead to the creation of a TButton component on the page, - + <com:TButton Text="Register" />

diff --git a/demos/quickstart/themes/Simple/style.css b/demos/quickstart/themes/Simple/style.css index 5bbae28b..406384d3 100644 --- a/demos/quickstart/themes/Simple/style.css +++ b/demos/quickstart/themes/Simple/style.css @@ -166,4 +166,11 @@ tt { margin: 10px; border: 1px solid silver; padding: 10px; +} + +.sampletitle { + width: 100%; + border-bottom:1px solid silver; + font-weight:bold; + margin-bottom:5px; } \ No newline at end of file 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