Problems with setting values for combobox

From: Date: Wed, 25 Apr 2007 15:16:45 +0000
Subject: Problems with setting values for combobox
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-7792@lists.php.net to get a copy of this message
Hello! I have a combobox where the user can choose a value and save this value in a database. The value is retrieved from the combobox with the following code:
             $model = $this->cmbTur->get_model();
             $iTur = $model->get_value($this->cmbTur->get_active_iter(), 0);
My problem is too set this combobox too the same value that the user choose when she reads the values back from the database. I am quite sure that the solution involves
             $this->cmbTur->set_active_iter();
Can anybody help me? Combo and ListStore setup: $lstStrTur = new GtkListStore(Gtk::TYPE_LONG,Gtk::TYPE_STRING); $lstStrTur->append(array(1,'Test 1')); $lstStrTur->append(array(2,'Test 2')); $lstStrTur->append(array(3,'Test 3')); $this->cmbTur = new GtkComboBox(); $this->cmbTur->set_model($lstStrTur); $cellRenderer = new GtkCellRendererText(); $this->cmbTur->pack_start($cellRenderer); $this->cmbTur->set_attributes($cellRenderer, 'text', 1); $table->attach($this->cmbTur, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK, 0, 0); I borrowed some code from the very helpful "php-gtk2 Cookbook" site. I have been searching and reading around the Net and now I have to ask in the list :-)

« previous php.gtk.general (#7792) next »