/**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the form
     $this->form = new TForm();
     $this->form->class = 'tform';
     // creates the form field container
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // title row
     $table->addRowSet(new TLabel('Automatic selections'), '')->class = 'tformtitle';
     // create the form fields
     // parameters (name, database, model, key, value)
     $radio = new TDBRadioGroup('radio', 'samples', 'Category', 'id', 'name');
     $check = new TDBCheckGroup('check', 'samples', 'Category', 'id', 'name');
     $combo = new TDBCombo('combo', 'samples', 'Category', 'id', 'name');
     $select = new TDBSelect('select', 'samples', 'Category', 'id', 'name');
     $search = new TDBMultiSearch('search', 'samples', 'Category', 'id', 'name');
     $autocomp = new TDBEntry('autocomplete', 'samples', 'Category', 'name');
     $search->setMinLength(3);
     $search->setOperator('like');
     //default data:
     $radio->setValue(2);
     $check->setValue(array(1, 3));
     $combo->setValue(2);
     $select->setValue(array(1, 3));
     $search->setValue(array(99 => 'Predefined'));
     $radio->setLayout('horizontal');
     $check->setLayout('horizontal');
     $combo->setSize(160);
     $select->setSize(200, 70);
     $search->setSize(300, 70);
     // add the fields to the table
     $table->addRowSet(new TLabel('TDBRadioGroup:'), $radio);
     $table->addRowSet(new TLabel('TDBCheckGroup:'), $check);
     $table->addRowSet(new TLabel('TDBCombo:'), $combo);
     $table->addRowSet(new TLabel('TDBSelect:'), $select);
     $table->addRowSet(new TLabel('TDBMultiSearch:'), $search);
     $table->addRowSet(new TLabel('TDBEntry:'), $autocomp);
     // creates the action button
     $button1 = new TButton('action1');
     // define the button action
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     $table->addRowSet($button1, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($radio, $check, $combo, $select, $search, $autocomp, $button1));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
 /**
  * 
  */
 public function makeTDBSelect($properties)
 {
     $widget = new TDBSelect((string) $properties->{'name'}, (string) $properties->{'database'}, (string) $properties->{'model'}, (string) $properties->{'key'}, (string) $properties->{'display'});
     $widget->setSize((int) $properties->{'width'}, (int) $properties->{'height'});
     if (isset($properties->{'tip'})) {
         $widget->setTip((string) $properties->{'tip'});
     }
     $this->fields[] = $widget;
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     return $widget;
 }