File: /pages/tutorials/object/object-07.php
<?php class Object07 extends Page { public function InitializeComponent() { parent::$PAGE_TITLE = "Tutorial : clickable Objects"; $form = new Form($this); $green_square = new WSPObject("<br/><br/>", "click"); $green_square->setId("my_object_green_7"); $green_square->setStyle("background-color:#5BFF4F;cursor:pointer;"); $green_square->setAlign(WSPObject::ALIGN_CENTER); $green_square->setWidth(100); $green_square->setHeight(100); $green_square->onClick($form, "onClickObject"); $red_square = new WSPObject("<br/><br/>", "click"); $red_square->setId("my_object_red_7"); $red_square->setStyle("background-color:#FF3300;cursor:pointer;"); $red_square->setAlign(WSPObject::ALIGN_CENTER); $red_square->setWidth(100); $red_square->setHeight(100); $red_square->onClick($form, "onClickObject"); $form->setContent(new WSPObject($green_square, $red_square)); $this->render = $form; } public function onClickObject($sender) { $dialog = new DialogBox("onClickObject", "click: ".$sender->getId()); $this->addObject($dialog); } } ?>
Go back to tutorial of the componant Object
|