summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/JuiControls
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2014-02-06 16:23:42 +0100
committerFabio Bas <ctrlaltca@gmail.com>2014-02-06 16:23:42 +0100
commit2c1d9d453404ec2e3344ef477bf834a2a3c065af (patch)
treed309eca34de724db2804e0febaab76a68b50b889 /demos/quickstart/protected/pages/JuiControls
parent705a311b3bbc223737a51bec1d2f978554da086a (diff)
Implemented basic support for callback events for JUI controls; TJuiDraggable and TJuiDroppable examples
Diffstat (limited to 'demos/quickstart/protected/pages/JuiControls')
-rw-r--r--demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.page6
-rw-r--r--demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.php16
-rw-r--r--demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.page8
-rw-r--r--demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.php22
4 files changed, 43 insertions, 9 deletions
diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.page b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.page
index 6912389d..349922cb 100644
--- a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.page
+++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.page
@@ -15,9 +15,13 @@
<tr><td class="samplenote">
Default options with a little css applied:
</td><td class="sampleaction" style="height:600px">
- <com:TJuiDraggable>
+ <com:TJuiDraggable
+ OnStart="drag1_start"
+ OnStop="drag1_stop"
+ >
Drag me around
</com:TJuiDraggable>
+ <com:TActiveLabel ID="label1" Text="Waiting.." />
</td></tr>
</table>
diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.php b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.php
new file mode 100644
index 00000000..348eea55
--- /dev/null
+++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDraggable/Home.php
@@ -0,0 +1,16 @@
+<?php
+
+class Home extends TPage
+{
+ protected function drag1_start($sender, $param)
+ {
+ $offset=$param->getCallbackParameter()->offset;
+ $this->label1->Text.="<br/>Start drag at (".$offset->left.",".$offset->top.")";
+ }
+
+ protected function drag1_stop($sender, $param)
+ {
+ $offset=$param->getCallbackParameter()->offset;
+ $this->label1->Text.="<br/>Stop drop at (".$offset->left.",".$offset->top.")";
+ }
+} \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.page b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.page
index 59cd3838..6059fe60 100644
--- a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.page
+++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.page
@@ -1,5 +1,5 @@
<com:TContent ID="body">
-<h1>TJuiDraggable Samples</h1>
+<h1>TJuiDroppable Samples</h1>
<com:TStyleSheet>
.ui-draggable {
@@ -28,19 +28,19 @@
<tr><td class="samplenote">
Default options with a little css applied:
</td><td class="sampleaction" style="height:600px">
- <com:TJuiDraggable>
+ <com:TJuiDraggable ID="drag1">
Drag me around
</com:TJuiDraggable>
<com:TJuiDroppable OnDrop="drop1_ondrop" CssClass="drop-yellow">
Drop it here!
<br/><com:TActiveLabel ID="label1" />
- </com:TJuiDroppable ID="drop1">
+ </com:TJuiDroppable>
<com:TJuiDroppable OnDrop="drop2_ondrop" CssClass="drop-red">
Drop it here!
<br/><com:TActiveLabel ID="label2" />
- </com:TJuiDroppable ID="drop1">
+ </com:TJuiDroppable>
</td></tr>
</table>
diff --git a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.php b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.php
index cdbe85ba..c59d035c 100644
--- a/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.php
+++ b/demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable/Home.php
@@ -4,13 +4,27 @@ class Home extends TPage
{
public function drop1_ondrop($sender, $param)
{
- $draggable=$param->getDroppedControl()->ID;
- $this->label1->Text="Dropped ".$draggable." at: <br/>Top=".$param->getOffsetTop()." Left=".$param->getOffsetLeft();
+ $draggable=$param->DraggableControl;
+ /* Equals to:
+ * $draggable=$param->getControl($param->getCallbackParameter()->draggable);
+ */
+ $offset=$param->getCallbackParameter()->offset;
+ $target=$param->getCallbackParameter()->target->offset;
+ $top=$offset->top - $target->top;
+ $left=$offset->left - $target->left;
+ $this->label1->Text="Dropped ".$draggable->ID." at: <br/>Top=".$top." Left=".$left;
}
public function drop2_ondrop($sender, $param)
{
- $draggable=$param->getDroppedControl()->ID;
- $this->label2->Text="Dropped ".$draggable." at: <br/>Top=".$param->getOffsetTop()." Left=".$param->getOffsetLeft();
+ $draggable=$param->DraggableControl;
+ /* Equals to:
+ * $draggable=$param->getControl($param->getCallbackParameter()->draggable);
+ */
+ $offset=$param->getCallbackParameter()->offset;
+ $target=$param->getCallbackParameter()->target->offset;
+ $top=$offset->top - $target->top;
+ $left=$offset->left - $target->left;
+ $this->label2->Text="Dropped ".$draggable->ID." at: <br/>Top=".$top." Left=".$left;
}
}