FW
Alinhamento - Form
Fechado
Pessoal,
Um novo help.
Estou fazendo um formulário, que recebe um parâmetro e contém um TMultifield.
Mas não consigo deixá-lo alinhado, na imagem em anexo, a primeira imagem é como está o formulário, eu gostaria de deixá-lo como na segunda.
Fazer uma separação e deixar a tela mais bonita, jogar o TEntry pra cima, mas o campo não vai, ele fica la no canto direito da tela, com uma separação enorme entre o Label e o TEntry.
Segue abaixo meu fonte:
Obrigado.
Um novo help.
Estou fazendo um formulário, que recebe um parâmetro e contém um TMultifield.
Mas não consigo deixá-lo alinhado, na imagem em anexo, a primeira imagem é como está o formulário, eu gostaria de deixá-lo como na segunda.
Fazer uma separação e deixar a tela mais bonita, jogar o TEntry pra cima, mas o campo não vai, ele fica la no canto direito da tela, com uma separação enorme entre o Label e o TEntry.
Segue abaixo meu fonte:
- <?php
- class FormReembolso extends TPage
- {
- private $form;
-
- /**
- * Class constructor
- * Creates the page
- */
- function __construct()
- {
- parent::__construct();
-
- // create the form
- $this->form = new TForm('formReembolso');
- $this->form->class = 'tform';
-
- $table = new TTable;
- $table->style = "width: 420px";
-
- $this->form->add($table);
-
- // add a row for the form title
- $row = $table->addRow();
- $row->class = 'tformtitle'; // CSS class
- $cell = $row->addCell( new TLabel('Reembolso'));
- $cell->colspan = 4;
-
- $multifield = new TMultiField('reembolso');
- $multifield->setOrientation('horizontal');
-
- 2533_viagem = new TEntry('id_viagem');
- $valor = new TEntry('valor');
- $tipo_reembolso = new TDBCombo('tipo_reembolso', 'gestao_viagens', 'TipoReembolso', 'id_tipo_reembolso', 'tipo_reembolso');
-
- 2533_viagem->setEditable(FALSE);
- 2533_viagem->style = "margin-left: 12px";
- $tipo_reembolso->setSize(180);
-
- $multifield->setHeight(140);
- $multifield->addField('tipo_reembolso', 'Tipo', $tipo_reembolso, 160, TRUE);
- $multifield->addField('valor','Valor', $valor, 147, TRUE);
-
- 2533_viagem->setSize(65);
- $valor->setSize(120);
- $valor->setNumericMask(2, ',', '.');
- $valor->style = "margin-left: 9px";
-
- // add ID VIAGEM
- $row_id=$table->addRow();
- $lbl = new TLabel('Id Viagem');
- $row_id->addCell($lbl);
- $row_id=$table->addRow();
- $row_id->addCell(2533_viagem);
-
-
- // add a row for one field
- $row=$table->addRow();
- $row->addCell( $multifield )->style = "padding-left: 12px";
-
- // creates the action button
- $button1=new TButton('action1');
- // define the button action
- $button1->setAction(new TAction(array($this, 'onSave')), 'Salvar');
- $button1->setImage('ico_save.png');
- // add a row for the button
- $row=$table->addRow();
- $row->addCell($button1);
-
- // define wich are the form fields
- $this->form->setFields(array(2533_viagem, $multifield, $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);
- }
-
- /**
- * Simulates an save button
- * Show the form content
- */
- public function onSave($param)
- {
- $data = $this->form->getData(); // optional parameter: active record class
-
- //var_dump($data);
- 2533_viagem = $data->id_viagem;
-
- // put the data back to the form
- $this->form->setData($data);
- $message = '';
-
- // get the tipo_reembolso
- if ($data->reembolso)
- {
- foreach ($data->reembolso as $contact)
- {
- $message .= 2533_viagem . ' - ' . $contact->valor . ' - ' . $contact->tipo_reembolso . '<br>';
- }
- }
-
- // show the message
- new TMessage('info', $message);
- }
-
- /**
- * method onEdit()
- * Solicitar Reembolso
- */
- public function onEdit($param)
- {
- try
- {
- $obj = new StdClass;
-
- if (isset($param['key']))
- {
- $key = $param['key'];
- //$obj->reembolso_id_viagem = $key;
- $obj->id_viagem = $key;
-
- //$this->form->setData($obj);
- TForm::sendData('formReembolso', $obj);
- }
- }
- catch (Exception $e)
- {
- new TMessage('error', '<b>Error:</b> ' . $e->getMessage());
- }
- }
- }
- ?>
Obrigado.
Lembre que quando trabalhamos com tabelas em html as colunas de diferentes linhas sempre ficam com o mesmo tamanho, que no caso é o tamanho da maior coluna.
O colspan deve resolver.
Nataniel,
Entendi.
Alterei conforme você sugeriu, mas não adiantou muito.
O TEntry ficou em cima da label valor aproximadamente.
Você pode definir o tamanho das colunas:
Nataniel.
Perfeito. Entendi como funciona.
Consegui ajeitar.
Obrigado pela ajuda novamente.