From 9be8859d92e4bbec2462e82457d014f0a0d720db Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 26 Dec 2005 15:54:54 +0000 Subject: --- .../protected/pages/Fundamentals/Components.page | 49 ++++++++++++++++++++++ .../protected/pages/Fundamentals/Controls.page | 19 +++++++++ .../protected/pages/Fundamentals/Pages.page | 8 ++++ 3 files changed, 76 insertions(+) create mode 100644 demos/quickstart/protected/pages/Fundamentals/Components.page create mode 100644 demos/quickstart/protected/pages/Fundamentals/Controls.page create mode 100644 demos/quickstart/protected/pages/Fundamentals/Pages.page (limited to 'demos/quickstart/protected/pages/Fundamentals') diff --git a/demos/quickstart/protected/pages/Fundamentals/Components.page b/demos/quickstart/protected/pages/Fundamentals/Components.page new file mode 100644 index 00000000..ec6dbd48 --- /dev/null +++ b/demos/quickstart/protected/pages/Fundamentals/Components.page @@ -0,0 +1,49 @@ + +

Components

+

+A component is an instance of TComponent or its child class. The base class TComponent implements the mechanism of component properties and events. +

+ +

Component Properties

+

+A component property can be viewed as a public variable describing a specific aspect of the component, such as the background color, the font size, etc. A property is defined by the existence of a getter and/or a setter method in the component class. For example, in TControl, we have +

+class TControl extends TComponent {
+    public function getID() {
+        ...
+    }
+    public function setID($value) {
+        ...
+    }
+}
+
+This defines a property named ID. Reading the property (e.g. echo $component->ID;) is equivalent to invoking the getter method (e.g. echo $component->getID();); and writing the property (e.g. $component->ID='Button';) is equivalent to invoking the setter method (e.g. $component->setID('Button');). +

+

+A property is read-only if it has a getter method but no setter method. Since PHP method names are case-insensitive, property names are also case-insensitive. A component class inherits all its ancestor classes' properties. +

+ +

Component Events

+

+Component events are special properties that take method names as their values. Attaching (setting) a method to an event will hook up the method to the places at which the event is raised. Therefore, the behavior of a component can be modified in a way that may not be foreseen during the development of the component. +

+

+A component event is defined by the existence of an on-method. For example, in TButton, we have +

+class TButton extends TWebControl {
+    public function onClick($param) {
+        ...
+    }
+}
+
+This defines an event named Click, and a handler can be attached to the event using one of the following ways, +
+$button->Click=$callback;
+$button->Click->add($callback);
+$button->Click[]=$callback;
+$button->attachEventHandler('Click',$callback);
+
+where $callback refers to a valid PHP callback (e.g. a function name, a class method array($object,'method'), etc.) +

+ +
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Fundamentals/Controls.page b/demos/quickstart/protected/pages/Fundamentals/Controls.page new file mode 100644 index 00000000..7703003d --- /dev/null +++ b/demos/quickstart/protected/pages/Fundamentals/Controls.page @@ -0,0 +1,19 @@ + +

Controls

+

+A control is an instance of class TControl or its subclass. A control is a component defined in addition with user interface. The base class TControl defines the parent-child relationship among controls which reflects the containment relationship among user interface elements. +

+ +

Parent-Child Relationship

+

+A parent control is in charge of the state transition of its child controls. The rendering result of the child controls are usually used to compose the parent control's presentation. +

+

+The parent-child relationship is usually established by the framework via templates. In code, you may explicitly specify a control as a child of another using the following method, +

+$parent->Controls->add($child);
+
+where the property Controls refers to the child control collection of the parent. +

+ +
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/Fundamentals/Pages.page b/demos/quickstart/protected/pages/Fundamentals/Pages.page new file mode 100644 index 00000000..71434ae1 --- /dev/null +++ b/demos/quickstart/protected/pages/Fundamentals/Pages.page @@ -0,0 +1,8 @@ + + +

Pages

+

+Pages are top-most controls that have no parent (you may consider application as their container though). The presentation of pages are directly displayed to end-users. +

+ +
\ No newline at end of file -- cgit v1.2.3