From 0cba2b20bb89e2be8728edb25e6a68a764d35c19 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 6 Feb 2006 17:01:15 +0000 Subject: Fixed a bug in TDataGrid about columnspan of pager cell. --- .../protected/pages/Controls/NewControl.page | 39 ++++++++++++++++++++-- .../Samples/LabeledTextBox2/LabeledTextBox.php | 2 +- .../Controls/Samples/TCustomValidator/Home.page | 6 ++-- .../pages/Controls/Samples/TDataGrid/Sample5.page | 2 +- 4 files changed, 42 insertions(+), 7 deletions(-) (limited to 'demos/quickstart/protected/pages') diff --git a/demos/quickstart/protected/pages/Controls/NewControl.page b/demos/quickstart/protected/pages/Controls/NewControl.page index 8e2a21cf..76999e79 100644 --- a/demos/quickstart/protected/pages/Controls/NewControl.page +++ b/demos/quickstart/protected/pages/Controls/NewControl.page @@ -48,13 +48,13 @@ In the above, the method call to ensureChildControls() ensures that bot

Composition by Overriding createChildControls()

-For a composite control as simple as LabeledTextBox, it is better to create it by extending TControl and overriding the createChildControls() method, because it does not use templates and thus saves template parsing time. +For a composite control as simple as LabeledTextBox, it is better to create it by extending TControl and overriding the createChildControls() method, because it does not use templates and thus saves template parsing time. Note, the new control class must implement the INamingContainer interface to ensure the global uniqueness of the ID of its constituent controls.

Complete code for LabeledTextBox is shown as follows,

-class LabeledTextBox extends TControl { +class LabeledTextBox extends TControl implements INamingContainer { private $_label; private $_textbox; protected function createChildControls() { @@ -91,10 +91,45 @@ In the above, Label.Text is a subproperty of LabeledTextBox, w

Extending Existing Controls

+

+Extending existing controls is the same as conventional class inheritance. It allows developers to customize existing control classes by overriding their methods or providing new functionalities. The difficulty of the task depends on how much an existing class needs to be customized. +

+

+In this section, we mainly introduce the base control classes TControl and TWebControl, showing how they can be customized. We also introduce how to write controls with specific functionalities, such as loading post data, raising post data and databinding with data source. +

Extending TControl

+

+TControl is the base class of all control classes. It implements the following properties and methods that are commonly used in derived control classes, +

+

Extending TWebControl

+

+getTagName() +addAttributesToRender +renderBeginTag +renderContents +renderEndTag +

+ +

PostBackHandler PostBackEvnetHandler DataBoundControl diff --git a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php index f4148148..0d410357 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php +++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php @@ -1,6 +1,6 @@ @@ -41,7 +41,7 @@ Custom validator with client-side validation disabled: EnableClientScript="false" ControlToValidate="TextBox2" ClientValidationFunction="myValidationFunction" - ServerValidate="serverValidate" + OnServerValidate="serverValidate" Text="You must enter 'test'." /> @@ -57,7 +57,7 @@ Custom validator with focus-on-error enabled and dynamic display: ValidationGroup="Group3" ControlToValidate="TextBox3" ClientValidationFunction="myValidationFunction" - ServerValidate="serverValidate" + OnServerValidate="serverValidate" FocusOnError="true" Text="You must enter 'test'." /> diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.page b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.page index 17f2c5d4..8fc393e7 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.page @@ -24,7 +24,7 @@ -- cgit v1.2.3