function __create_box()
 {
     $vbox = new GtkVBox(false, 5);
     $vbox->set_border_width(5);
     $label = new GtkLabel();
     $label->set_markup('Completion demo, try writing <b>total</b> or <b>gnome</b> for example.');
     $vbox->pack_start($label, false, false, 0);
     $entry = new GtkEntry();
     $vbox->pack_start($entry, false, false, 0);
     $completion = new GtkEntryCompletion();
     $completion_model = $this->__create_completion_model();
     $completion->set_model($completion_model);
     $completion->set_text_column(0);
     $entry->set_completion($completion);
     return $vbox;
 }
Beispiel #2
0
 function __construct($Owner)
 {
     parent::__construct();
     $this->pack_start(new GtkLabel(' Fornecedor: '), false);
     $completion = new GtkEntryCompletion();
     $completion->set_model($this->store = new GtkListStore(TYPE_STRING, TYPE_LONG));
     $completion->set_text_column(0);
     $completion->pack_start($cell = new GtkCellRendererText());
     $completion->set_attributes($cell, 'text', 1);
     $completion->connect('match-selected', array($this, 'fornecedor_selected'));
     $this->pack_start($this->entry = new GtkEntry());
     $this->entry->set_completion($completion);
     $this->show_all();
     /*
      * preenche lista
      */
     $db = new Database($Owner, true);
     if (!$db->link) {
         return;
     }
     /*
      * Fornecedores
      */
     if (!$db->multi_query('SELECT * FROM Vw_Fornecedores')) {
         return;
     }
     $this->store->clear();
     unset($this->it);
     while ($line = $db->line()) {
         $row = $this->store->append();
         $this->store->set($row, 0, $line['Nome'], 1, $line['Id']);
         $this->it[$line['Id']] = $row;
     }
 }
Beispiel #3
0
 /**
  * Define options for completion
  * @param $options array of options for completion
  */
 function setCompletion($options)
 {
     $store = new GtkListStore(GObject::TYPE_STRING);
     if (is_array($options)) {
         foreach ($options as $option) {
             $store->append(array($option));
         }
     }
     $completion = new GtkEntryCompletion();
     $completion->set_model($store);
     $completion->set_text_column(0);
     parent::set_completion($completion);
 }
Beispiel #4
0
 function cli_for_clicked()
 {
     unset($this->CodCliFor);
     $children = $this->box_cli_for->get_children();
     foreach ($children as $child) {
         $child->destroy();
     }
     $this->tipo_cli_for = $this->tipo_cli_for == 0 ? '1' : '0';
     // Ativa / Desativa controles
     if (isset($this->cot_compra)) {
         $this->cot_compra->set_sensitive($this->tipo_cli_for == '0' ? false : true);
     }
     if (isset($this->cot_venda)) {
         $this->cot_venda->set_sensitive($this->tipo_cli_for == '0' ? true : false);
     }
     if (isset($this->ped_compra)) {
         $this->ped_compra->set_sensitive($this->tipo_cli_for == '0' ? false : true);
     }
     if (isset($this->ped_venda)) {
         $this->ped_venda->set_sensitive($this->tipo_cli_for == '0' ? true : false);
     }
     // Cliente / Fornecedor
     $this->box_cli_for->pack_start(new GtkLabel($this->tipo_cli_for == '0' ? ' Cliente: ' : ' Fornecedor: '), false);
     $completion = new GtkEntryCompletion();
     $completion->set_model($this->st_cli_for = new GtkListStore(TYPE_STRING, TYPE_LONG));
     $completion->set_text_column(0);
     $completion->pack_start($cell = new GtkCellRendererText());
     $completion->set_attributes($cell, 'text', 1);
     $completion->connect('match-selected', array($this, 'cli_for_selected'));
     $this->box_cli_for->pack_start($this->cli_for = new GtkEntry());
     $this->cli_for->set_completion($completion);
     $this->box_cli_for->pack_start(new GtkEventBox());
     $this->box_cli_for->show_all();
     $this->preenche_campos();
 }