// adiciona as opções ao radio button $sexo->addItems($items); // define a opção ativa $sexo->setValue('M'); // define a posição dos elementos $sexo->setLayout('horizontal'); // cria um vetor com as opções de idiomas $items = array(); $items['E'] = 'Inglês'; $items['S'] = 'Espanhol'; $items['I'] = 'Italiano'; $items['F'] = 'Francês'; // adiciona as opções ao check button $linguas->addItems($items); // define as opções ativas $linguas->setValue(array('E', 'I')); // define um valor padrão para o campo $qualifica->setValue('<digite suas qualificações aqui>'); $qualifica->setSize(240); // adiciona uma linha para o campo código na tabela $row = $table->addRow(); $row->addCell(new TLabel('Código:')); $row->addCell($codigo); // adiciona uma linha para o campo nome na tabela $row = $table->addRow(); $row->addCell(new TLabel('Nome:')); $row->addCell($nome); // adiciona uma linha para o campo endereço na tabela $row = $table->addRow(); $row->addCell(new TLabel('Endereço:')); $row->addCell($endereco);
/** * 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('Static selections'), '')->class = 'tformtitle'; // create the form fields $radio = new TRadioGroup('radio'); $check = new TCheckGroup('check'); $combo = new TCombo('combo'); $select = new TSelect('select'); $search = new TMultiSearch('search'); $autocomp = new TEntry('autocomplete'); $radio->setLayout('horizontal'); $check->setLayout('horizontal'); $combo->setSize(100); $select->setSize(200, 70); $search->setSize(300, 70); $items = array(); $items['a'] = 'Item a'; $items['b'] = 'Item b'; $items['c'] = 'Item c'; $radio->addItems($items); $check->addItems($items); $combo->addItems($items); $select->addItems($items); $search->addItems($items); $autocomp->setCompletion(array_values($items)); foreach ($radio->getLabels() as $key => $label) { $label->setTip("Radio {$key}"); } foreach ($check->getLabels() as $key => $label) { $label->setTip("Check {$key}"); } // define default values $search->setMinLength(3); $radio->setValue('a'); $check->setValue(array('a', 'c')); $combo->setValue('b'); $select->setValue(array('b', 'c')); $search->setValue(array('b' => 'Item b')); // add the fields to the table $table->addRowSet(new TLabel('TRadioGroup:'), $radio); $table->addRowSet(new TLabel('TCheckGroup:'), $check); $table->addRowSet(new TLabel('TCombo:'), $combo); $table->addRowSet(new TLabel('TSelect:'), $select); $table->addRowSet(new TLabel('TMultiSearch:'), $search); $table->addRowSet(new TLabel('Autocomplete:'), $autocomp); // creates the action button $button1 = new TButton('action1'); $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 makeTCheckGroup($properties) { $widget = new TCheckGroup((string) $properties->{'name'}); $widget->setLayout('vertical'); $pieces = explode("\n", (string) $properties->{'items'}); $items = array(); if ($pieces) { foreach ($pieces as $line) { $part = explode(':', $line); $items[$part[0]] = $part[1]; } } $widget->addItems($items); if (isset($properties->{'value'})) { $widget->setValue(explode(',', (string) $properties->{'value'})); } if (isset($properties->{'tip'})) { $widget->setTip((string) $properties->{'tip'}); } $this->fields[] = $widget; $this->fieldsByName[(string) $properties->{'name'}] = $widget; return $widget; }
$datanasc->setSize('100'); //Adiciona as opções ao Radio Button $sexo->addItems($itens); //Define opção Ativa $sexo->setValue('M'); //Define posição dos Elementos $sexo->setLayout('horizontal'); //Cria um vetor com as opções de Idiomas $itens = array(); $itens['I'] = 'Ingles'; $itens['E'] = 'Espanhol'; $itens['P'] = 'Portugues'; //Adiciona as opções ao Check Button $linguas->addItems($itens); //Define opções Ativas $linguas->setValue(array('I', 'P')); //Define um valor padrão para o campo $qualifica->setValue('<Digite suas qualificações aqui>'); $qualifica->setSize('240', '100'); //Adiciona uma linha para o Campo Codigo na Tabela $row = $table->addRow(); $row->addCell(new TLabel('Codigo: ')); $row->addCell($codigo); //Adiciona uma linha para o Campo Nome na Tabela $row = $table->addRow(); $row->addCell(new TLabel('Nome: ')); $row->addCell($nome); //Adiciona uma linha para o Campo Endereço na Tabela $row = $table->addRow(); $row->addCell(new TLabel('Endereço: ')); $row->addCell($endereco);