The best IT partner for your business English version

Framework docs

Presentation > Designer > Containers

More productivity with Adianti Studio Pro

  • Forms designer;
  • Automatic form generation;
  • Automatic datagrid generation;
  • Create DB from your UML;
Ver detalhes...

This sample demonstrates a complex interface created using Adianti Studio Form Designer. In this interface we have a group of TNotebook objects with a great variety of another objects inside, from input objects to another TNotebook objects.

To render the interface we use the TUIBuilder class, that is an interface builder. It takes a XML file save by Adianti Studio Designer and renders the form into the interface. The TUIBuilder is a subclass of TPanel, what means it has the same behavior, organizing the widgets in fixed coordinates. TUIBuilder parses a XML file created by Adianti Studio Designer and creates all the widgets represented inside the XML file through the parseFile() method. The TUIBuilder instance can be added inside any other container like a TNotebook, TTable or directly into TPage controller.

Important: This samples uses a interface (screen) designed in Adianti Studio Form Designer. Adianti Studio Form Designer is a complete tool that allows the user to draw forms and datagrids with a graphical interface (drag and drop) using the framework components and containers (TEntry, TCombo, TRadioGroup, TFrame, and others. This interface is saved in XML and may be used by the TUIBuilder class, and its parseFile() method to recreate it dynamically during the application execution time.

Click here for
live demonstration

Example

  1. <?php
  2. /**
  3.  * DesignContainerView Registration
  4.  *
  5.  * @version    1.0
  6.  * @package    samples
  7.  * @subpackage tutor
  8.  * @author     Pablo Dall'Oglio
  9.  * @copyright  Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
  10.  * @license    http://www.adianti.com.br/framework-license
  11.  */
  12. class DesignContainerView extends TPage
  13. {
  14.     private $form;
  15.     
  16.     /**
  17.      * Class constructor
  18.      * Creates the page and the registration form
  19.      */
  20.     function __construct()
  21.     {
  22.         parent::__construct();
  23.         
  24.         // creates the form
  25.         $this->form = new TForm;
  26.         
  27.         try
  28.         {
  29.             // UIBuilder object
  30.             $ui = new TUIBuilder(500400);
  31.             $ui->setController($this);
  32.             $ui->setForm($this->form);
  33.             
  34.             // reads the xml form
  35.             $ui->parseFile('app/forms/containers.form.xml');
  36.             
  37.             // add the TUIBuilder panel inside the form
  38.             $this->form->add($ui);
  39.             // set the form fields from the interface
  40.             $this->form->setFields($ui->getFields());
  41.         }
  42.         catch (Exception $e)
  43.         {
  44.             new TMessage('error'$e->getMessage());
  45.         }
  46.         
  47.         // wrap the page content using vertical box
  48.         $vbox = new TVBox;
  49.         $vbox->add(new TXMLBreadCrumb('menu.xml'__CLASS__));
  50.         $vbox->add($this->form);
  51.         parent::add($vbox);
  52.     }
  53. }
  54. ?>