diff options
author | wei <> | 2006-08-12 12:54:27 +0000 |
---|---|---|
committer | wei <> | 2006-08-12 12:54:27 +0000 |
commit | 1180e6486139a9c9662984367c4f624394e06f35 (patch) | |
tree | f89a379960284595d5a425e22424582eea57422c /tests/FunctionalTests/active-controls/protected/pages | |
parent | 54d4919e3f1b00b644fa3c107acdf20159a1b154 (diff) |
Add Triggered Callbacks
Diffstat (limited to 'tests/FunctionalTests/active-controls/protected/pages')
-rw-r--r-- | tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.page | 31 | ||||
-rw-r--r-- | tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.php | 21 | ||||
-rw-r--r-- | tests/FunctionalTests/active-controls/protected/pages/PeriodicCallbackTest.page (renamed from tests/FunctionalTests/active-controls/protected/pages/CallbackTimerTest.page) | 16 | ||||
-rw-r--r-- | tests/FunctionalTests/active-controls/protected/pages/PeriodicCallbackTest.php (renamed from tests/FunctionalTests/active-controls/protected/pages/CallbackTimerTest.php) | 10 | ||||
-rw-r--r-- | tests/FunctionalTests/active-controls/protected/pages/ValueTriggerCallbackTest.page | 14 | ||||
-rw-r--r-- | tests/FunctionalTests/active-controls/protected/pages/ValueTriggerCallbackTest.php | 12 |
6 files changed, 91 insertions, 13 deletions
diff --git a/tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.page b/tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.page new file mode 100644 index 00000000..889636f3 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.page @@ -0,0 +1,31 @@ +<com:TForm ID="form1">
+
+ <h1>Event Triggered Callback Test</h1>
+
+ <com:TTextBox ID="text1" Text="Focus me" />
+
+ <com:TPanel ID="panel1" style="padding: 2em; border:1px solid #ccc; background-color: #ffc;">
+ Mouse over this panel
+ </com:TPanel>
+
+ <input id="button1" type="button" value="Click me" />
+
+ <com:TEventTriggeredCallback
+ ControlID="text1"
+ EventName="focus"
+ OnCallback="text1_focused" />
+
+ <com:TEventTriggeredCallback
+ ControlID="panel1"
+ EventName="mouseover"
+ OnCallback="panel1_onmouseover" />
+
+ <com:TEventTriggeredCallback
+ ControlID="button1"
+ OnCallback="button1_clicked" />
+
+ <div style="padding: 2em; border:1px solid #ccc; margin-top:2em">
+ <com:TActiveLabel ID="label1" Text="Label 1" />
+ </div>
+ <com:TJavascriptLogger />
+</com:TForm>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.php b/tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.php new file mode 100644 index 00000000..dc47d867 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.php @@ -0,0 +1,21 @@ +<?php
+
+class EventTriggeredCallback extends TPage
+{
+ function text1_focused($sender, $param)
+ {
+ $this->label1->Text = 'text 1 focused';
+ }
+
+ function panel1_onmouseover($sender, $param)
+ {
+ $this->label1->Text = 'panel 1 on mouse over '.time();
+ }
+
+ function button1_clicked($sender, $param)
+ {
+ $this->label1->Text = 'button 1 clicked';
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/CallbackTimerTest.page b/tests/FunctionalTests/active-controls/protected/pages/PeriodicCallbackTest.page index 8e99e528..bbc12862 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/CallbackTimerTest.page +++ b/tests/FunctionalTests/active-controls/protected/pages/PeriodicCallbackTest.page @@ -1,18 +1,18 @@ <com:TForm ID="form1"> - <h1>TCallbackTimer + ViewState Tests</h1> + <h1>TPeriodicCallback + ViewState Tests</h1> <com:TActiveButton id="button1" Text="Start Timer" OnCallback="start_timer" /> <com:TActiveButton Text="Stop Timer" OnCallback="stop_timer" /> <div style="margin:1em; padding:1em; border:1px solid #ccc;"> <com:TActiveLabel ID="label1" Text="ViewState Counter : " /> </div> - <com:TCallbackTimer ID="timer1" Interval="0.1" OnCallback="tick"> - <prop:ActiveControl.ClientSide - OnLoading="$('status').show()" + <com:TPeriodicCallback ID="timer1" Interval="0.1" OnCallback="tick"> + <prop:ActiveControl.ClientSide + OnLoading="$('status').show()" OnComplete="$('status').hide()" /> - </com:TCallbackTimer> - <div id="status" style="margin:1em; padding:0.5em; - text-align:center; - background-color:#900; + </com:TPeriodicCallback> + <div id="status" style="margin:1em; padding:0.5em; + text-align:center; + background-color:#900; color:white; display: none; position: absolute; right: 0; top: 0"> Loading... diff --git a/tests/FunctionalTests/active-controls/protected/pages/CallbackTimerTest.php b/tests/FunctionalTests/active-controls/protected/pages/PeriodicCallbackTest.php index da87ac0f..13633a00 100644 --- a/tests/FunctionalTests/active-controls/protected/pages/CallbackTimerTest.php +++ b/tests/FunctionalTests/active-controls/protected/pages/PeriodicCallbackTest.php @@ -1,23 +1,23 @@ <?php -class CallbackTimerTest extends TPage +class PeriodicCallbackTest extends TPage { function start_timer($sender, $param) { $this->timer1->startTimer(); $this->setViewState('count', 0); } - + function stop_timer($sender, $param) { $this->timer1->stopTimer(); } - + function tick($sender, $param) { $count = intval($this->getViewState('count')); - $this->setViewState('count', ++$count); - if($count > 10) + $this->setViewState('count', ++$count); + if($count > 10) $this->timer1->stopTimer(); else $this->label1->Text .= " ".$count; diff --git a/tests/FunctionalTests/active-controls/protected/pages/ValueTriggerCallbackTest.page b/tests/FunctionalTests/active-controls/protected/pages/ValueTriggerCallbackTest.page new file mode 100644 index 00000000..1281cc5c --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/ValueTriggerCallbackTest.page @@ -0,0 +1,14 @@ +<com:TForm>
+<h1>Value Trigger Callback Test</h1>
+
+<com:TTextBox ID="text1" />
+
+<com:TValueTriggeredCallback
+ ControlID="text1"
+ OnCallback="text1_changed" />
+
+<com:TActiveLabel ID="label1" Text="Label 1" />
+
+<com:TJavascriptLogger />
+
+</com:TForm>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/ValueTriggerCallbackTest.php b/tests/FunctionalTests/active-controls/protected/pages/ValueTriggerCallbackTest.php new file mode 100644 index 00000000..c3c44252 --- /dev/null +++ b/tests/FunctionalTests/active-controls/protected/pages/ValueTriggerCallbackTest.php @@ -0,0 +1,12 @@ +<?php
+
+class ValueTriggerCallbackTest extends TPage
+{
+ function text1_changed($sender, $param)
+ {
+ $values = $param->getParameter();
+ $this->label1->Text = "Old = ".$values->OldValue." : New Value = ".$values->NewValue;
+ }
+}
+
+?>
\ No newline at end of file |