From 2c1d9d453404ec2e3344ef477bf834a2a3c065af Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 6 Feb 2014 16:23:42 +0100 Subject: Implemented basic support for callback events for JUI controls; TJuiDraggable and TJuiDroppable examples --- .../JuiControls/Samples/TJuiDroppable/Home.page | 8 ++++---- .../JuiControls/Samples/TJuiDroppable/Home.php | 22 ++++++++++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) (limited to 'demos/quickstart/protected/pages/JuiControls/Samples/TJuiDroppable') 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 @@ -

TJuiDraggable Samples

+

TJuiDroppable Samples

.ui-draggable { @@ -28,19 +28,19 @@ Default options with a little css applied: - + Drag me around Drop it here!
-
+ Drop it here!
-
+ 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:
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:
Top=".$top." Left=".$left; } public function drop2_ondrop($sender, $param) { - $draggable=$param->getDroppedControl()->ID; - $this->label2->Text="Dropped ".$draggable." at:
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:
Top=".$top." Left=".$left; } } -- cgit v1.2.3