/**
  * callback function from create action
  *
  * @param string $login who clicked the action id
  * @param array $entries will be keyed array of inputboxes
  */
 function Ok($login, $entries)
 {
     // set new message to salute
     $this->dicoLabel->setText(exp_getMessage('Hello %1$s'), array($entries["toWho"]));
     // set inputbox with same value as you typed, you could reset it here by entering empty value
     $this->inputbox->setText($entries["toWho"]);
     // finally redraw window
     $this->redraw();
 }
 protected function exp_onBeginConstruct()
 {
     /**
      * Let's first give a name to our widget. This name need to be unique. It is going to be used to store player
      * configurations on this widget in their persisten variables.
      *
      * It is also going to be used to preload some settings. We will discuss about this at another place.
      *
      * Finally it is going yo be used in the ingame debug window when you click CTRL+G
      */
     $this->setName("acmeWidget");
     /**
      * We are going to use an element created for eXpansion windows to use as title on our widget.
      * An element is basically a group of labels & quads.
      *
      * This element takes in parameter it's size to generate properly the background and...
      */
     $this->titlebar = new \ManiaLivePlugins\eXpansion\Gui\Elements\WidgetTitle(60, 20);
     /**
      * Here we set the title of the title bar.
      *
      * Note that we are not passing a string but the translation object in parameter. The Gui handler will use this
      * to create the proper content so that the game might translate it to the players that will receive this plugin.
      */
     $this->titlebar->setText(exp_getMessage("acmePlugin actions"));
     $this->titlebar->setDirection("top");
     // can be top, left or right
     /**
      * Finally we add the title bar inside our widget. Note that we didnt set it's position. This element will
      * automatically calculate it.
      */
     $this->addComponent($this->titlebar);
     /**
      * Now we are going to create a button and will put some actions on to this button. We are using an
      * eXpanion Element again. This will create a button with proper background and borders.
      */
     $this->button = new \ManiaLivePlugins\eXpansion\Gui\Elements\Button();
     /**
      * We position the button. relative to the position of the windows.
      */
     $this->button->setPosition(3, -8);
     /**
      * We add an action to the button. The action will call the open function of this object thanks to the callback
      * array($this, 'open'). The action will also send a parameter with the information "window" to the method
      * when it is called. (we can put here an array or an object anything).
      */
     $this->button->setAction($this->createAction(array($this, "open"), "window"));
     // Adding a simple text to the button.
     $this->button->setText("such Windows");
     // Finally add the button to the current window.
     $this->addComponent($this->button);
     /**
      * We will create a second button, which has a special color.
      */
     $this->button2 = new \ManiaLivePlugins\eXpansion\Gui\Elements\Button();
     $this->button2->setPosition(3, -16);
     // We are going to colorize this button to green instead of the default color.
     $this->button2->colorize("0f0");
     $this->button2->setAction($this->createAction(array($this, "open"), "fun on"));
     $this->button2->setText("much fun");
     $this->addComponent($this->button2);
     /**
      * Finally create a red button.
      */
     $this->button3 = new \ManiaLivePlugins\eXpansion\Gui\Elements\Button();
     $this->button3->setPosition(30, -16);
     $this->button3->colorize("f00");
     $this->button3->setAction($this->createAction(array($this, "open"), "fun off"));
     $this->button3->setText("less fun");
     $this->addComponent($this->button3);
 }