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 ++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 demos/quickstart/protected/pages/ActiveControls/ActiveButton.page (limited to 'demos/quickstart/protected/pages/ActiveControls/ActiveButton.page') 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 -- cgit v1.2.3