From f1f33db1f85c0893205a4a00c203d884dc1af1a5 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sun, 10 Sep 2006 01:03:56 +0000 Subject: Changed TCallbackEventParameter::Parameter to TCallbackEventParameter::CallbackParameter Add TActiveButton and TActiveCheckBox quickstart docs. --- .../pages/ActiveControls/ActiveButton.page | 95 ++++++++++++++++++++++ .../pages/ActiveControls/ActiveCheckBox.page | 23 ++++++ .../protected/pages/ActiveControls/Home.page | 82 +++++++++++-------- .../pages/ActiveControls/Introduction.page | 8 ++ .../ActiveControls/Samples/TActiveButton/Home.page | 49 +++++++++++ .../ActiveControls/Samples/TActiveButton/Home.php | 20 +++++ .../Samples/TActiveCheckBox/Home.page | 77 ++++++++++++++++++ .../Samples/TActiveCheckBox/Home.php | 16 ++++ .../pages/ActiveControls/Samples/config.xml | 8 ++ 9 files changed, 342 insertions(+), 36 deletions(-) create mode 100644 demos/quickstart/protected/pages/ActiveControls/ActiveButton.page create mode 100644 demos/quickstart/protected/pages/ActiveControls/ActiveCheckBox.page create mode 100644 demos/quickstart/protected/pages/ActiveControls/Introduction.page create mode 100644 demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.page create mode 100644 demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.php create mode 100644 demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.page create mode 100644 demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.php create mode 100644 demos/quickstart/protected/pages/ActiveControls/Samples/config.xml (limited to 'demos/quickstart/protected/pages/ActiveControls') diff --git a/demos/quickstart/protected/pages/ActiveControls/ActiveButton.page b/demos/quickstart/protected/pages/ActiveControls/ActiveButton.page new file mode 100644 index 00000000..7bbe05ea --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/ActiveButton.page @@ -0,0 +1,95 @@ + + +

TActiveButton

+ + +

TActiveButton is the active control counter part to +TButton. +When a TActiveButton is clicked, rather than a normal post back request a +callback request is initiated. The OnCallback event is raised +during a callback request and it is raise after +the OnClick event. +

+ +

When the ActiveControl.EnableUpdate property is true, +changing the Text property during a callback request will update +the button's caption on the client-side.

+ +

Since the OnCallback event is raised only during a callback request, +the OnCallback event handler can be used to handle logic specifically +related to callback requests. The OnClick event handler is raised +when ever the button is clicked, even if javascript is disabled.

+ +

The following example the use of both the OnClick and OnCallback +events of an TActiveButton.

+ + + +

TActiveButton Class Diagram

+

The class diagram for TActiveButton is illustrated in the figure below. +Most active control that can perform callback request have a similar structure. +

+ + class="figure" + alt="TActiveButton class diagram" title="TActiveButton class diagram" /> + +

TActiveButton is an extension of TButton +and implements two additional interfaces ICallbackEventHandler and +IActiveControl. The TActiveButton contains an instance of +TBaseActiveCallbackControl +available through the ActiveControl property of TActiveButton. +The following example set the callback parameter of the TActiveButton when +a callback request is dispatched. +

+ +<com:TActiveButton + Text="Click Me" + OnCallback="button_callback" + ActiveControl.CallbackParameter="value" /> + +

In the OnCallback event handler method, the CallbackParameter +is available in the $param object.

+ +public function button_callback($sender, $param) +{ + echo $param->CallbackParameter; //outputs "value" +} + + +

Adding Client Side Behaviour

+ +

With in the ActiveControl property is an instance of +TCallbackClientSide available +as a property ClientSide of ActiveControl or similarly +as a sub-property ActiveControl.ClientSide of TActiveButton. +The ClientSide property contains sub-properties, such as RequestTimeOut, +and client-side javascript event handler, such as OnLoading, +that are used by the client-side when making a callback request. +The following example demonstrates the toggling of a "loading" indicator +when the client-side is making a callback request. +

+ + +<com:TClientSide PradoScripts="effects" /> +Loading... + +<com:TActiveButton + Text="Click Me" + OnCallback="button_callback" + ActiveControl.CallbackParameter="value" > + <prop:ActiveControl.ClientSide + OnLoading="Element.show('callback_status')" + OnComplete="Element.hide('callback_status')" /> +</com:TActiveButton> + + +

The example loads the "effects" javascript library using the +TClientScript component. +The ActiveControl.ClientSide.OnLoading property value contains +javascript statement that uses the "effects" library to show the "Loading..." +span tag. Similarly, ActiveControl.ClientSide.OnComplete property +value contains the javascript statement that hides the "Loading..." span tag. +See TCallbackClientSide for +further details on client-side property details. +

+
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/ActiveCheckBox.page b/demos/quickstart/protected/pages/ActiveControls/ActiveCheckBox.page new file mode 100644 index 00000000..d66c48f5 --- /dev/null +++ b/demos/quickstart/protected/pages/ActiveControls/ActiveCheckBox.page @@ -0,0 +1,23 @@ + + +

TActiveCheckBox

+ + +

+TActiveCheckBox is the active control counter part to +TCheckbox. The AutoPostBack + property of TActiveCheckBox is set to true by default. + Thus, when the checkbox is clicked the + OnCallback event is raise after the OnCheckedChanged event. +

+ +

+ The Text and Checked properties of TActiveCheckBox + can be changed during a callback request. The TextAlign property + of TActiveCheckBox can not be changed during + a callback request. +

+ + + +
\ No newline at end of file diff --git a/demos/quickstart/protected/pages/ActiveControls/Home.page b/demos/quickstart/protected/pages/ActiveControls/Home.page index e3f13640..9b9e3067 100644 --- a/demos/quickstart/protected/pages/ActiveControls/Home.page +++ b/demos/quickstart/protected/pages/ActiveControls/Home.page @@ -1,7 +1,22 @@ -

ActiveControls (AJAX)

-

Active Controls allows the browser to communicate with server -without refreshing the current page. + +

Active Controls (AJAX enabled Controls)

+

See the Introduction +for a quick overview of the concept behind active controls (AJAX enabled controls). +Most active controls have a property of +ActiveControl and +a sub-property ActiveControl.ClientSide +that provides many properties to customize the controls. The +CallbackClient property of the +TPage class provides many methods to update and alter the client-side content +during a callback request. Active controls is reliant on a collection +of javascript classes. +

+ +

For a quick demo of active controls, try the +TActiveButton control.

+ +

* the tutorial for this control is not completed yet.

Standard Active Controls