/** * */ public function makeTPassword($properties) { $widget = new TPassword((string) $properties->{'name'}); $widget->setValue((string) $properties->{'value'}); $widget->setSize((int) $properties->{'width'}); $widget->setEditable((string) $properties->{'editable'}); if (isset($properties->{'tip'})) { $widget->setTip((string) $properties->{'tip'}); } if (isset($properties->{'required'}) and $properties->{'required'} == '1') { $widget->addValidation((string) $properties->{'name'}, new TRequiredValidator()); } $this->fields[] = $widget; $this->fieldsByName[(string) $properties->{'name'}] = $widget; return $widget; }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // create the notebook $notebook = new TNotebook(620, 340); // create the form $this->form = new TForm(); // creates the notebook page $table = new TTable(); // add the notebook inside the form $this->form->add($table); // adds the notebook page $notebook->appendPage('Input elements', $this->form); // create the form fields $field1 = new TEntry('field1'); $field2 = new TEntry('field2'); $field3 = new TEntry('field3'); $field4 = new TEntry('field4'); $field5 = new TPassword('field5'); $field6 = new TDate('field6'); $field7 = new TSpinner('field7'); $field8 = new TSlider('field8'); $field9 = new TText('field9'); $field1->setTip('Tip for field 1'); $field2->setTip('Tip for field 2'); $field3->setTip('Tip for field 3'); $field4->setTip('Tip for field 4'); $field5->setTip('Tip for field 5'); $field6->setTip('Tip for field 6'); $field7->setTip('Tip for field 7'); $field8->setTip('Tip for field 8'); $field9->setTip('Tip for field 9'); $field2->setValue('123'); $field2->setEditable(FALSE); $field3->setMask('99.999-999'); $field4->setMaxLength(10); $field6->setSize(100); $field7->setRange(0, 100, 10); $field8->setRange(0, 100, 10); $field7->setValue(30); $field8->setValue(50); $field9->setSize(300, 50); // add rows for the fields $table->addRowSet(new TLabel('TEntry object:'), $field1); $table->addRowSet(new TLabel('TEntry not editable:'), $field2); $table->addRowSet(new TLabel('TEntry with mask:'), $field3, new TLabel('99.999-999')); $table->addRowSet(new TLabel('TEntry with maxlength (10):'), $field4); $table->addRowSet(new TLabel('TPassword object:'), $field5); $table->addRowSet(new TLabel('TDate Object:'), $field6); $table->addRowSet(new TLabel('Spinner Object:'), $field7); $table->addRowSet(new TLabel('Slider Object:'), $field8); $table->addRowSet(new TLabel('TText Object:'), $field9); // 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'); // define wich are the form fields $this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $button1)); // add a row for the button $row = $table->addRow(); $row->addCell($button1); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($notebook); parent::add($vbox); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // create the notebook $notebook = new TNotebook(620, 410); // create the form $this->form = new TForm(); // creates the notebook page $table = new TTable(); // add the notebook inside the form $this->form->add($table); // adds the notebook page $notebook->appendPage('Input elements', $this->form); // create the form fields $field1 = new TEntry('field1'); $field2 = new TEntry('field2'); $field3 = new TEntry('field3'); $field4 = new TEntry('field4'); $field5 = new TEntry('field5'); $field6 = new TPassword('field6'); $field7 = new TDate('field7'); $field8 = new TSpinner('field8'); $field9 = new TSlider('field9'); $field10 = new TText('field10'); $field1->setTip('Tip for field 1'); $field2->setTip('Tip for field 2'); $field3->setTip('Tip for field 3'); $field4->setTip('Tip for field 4'); $field5->setTip('Tip for field 5'); $field6->setTip('Tip for field 6'); $field7->setTip('Tip for field 7'); $field8->setTip('Tip for field 8'); $field9->setTip('Tip for field 9'); $field10->setTip('Tip for field 10'); $field2->setValue('123'); $field2->setEditable(FALSE); $field3->setMask('99.999-999'); $field4->setMaxLength(10); $field5->setCompletion(array('Allen', 'Albert', 'Alberto', 'Alladin')); $field7->setSize(100); $field8->setRange(0, 100, 10); $field9->setRange(0, 100, 10); $field8->setValue(30); $field9->setValue(50); $field10->setSize(300, 80); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry object:')); $cell = $row->addCell($field1); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry not editable:')); $cell = $row->addCell($field2); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry with mask:')); $cell = $row->addCell($field3); $cell = $row->addCell(new TLabel('99.999-999')); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry with maxlength (10):')); $cell = $row->addCell($field4); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry with completion (a..):')); $cell = $row->addCell($field5); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TPassword object:')); $cell = $row->addCell($field6); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TDate Object:')); $cell = $row->addCell($field7); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('Spinner Object:')); $cell = $row->addCell($field8); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('Slider Object:')); $cell = $row->addCell($field9); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TText Object:')); $cell = $row->addCell($field10); // 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'); // define wich are the form fields $this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $field10, $button1)); // add a row for the button $row = $table->addRow(); $row->addCell($button1); // add the form inside the page parent::add($notebook); }