Re: bug
| From: | Elizabeth M Smith | Date: | Fri, 13 Feb 2009 03:39:54 +0000 |
| Subject: | Re: bug | ||
| References: | 1 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-4317@lists.php.net to get a copy of this message | ||
Pablo DallOglio wrote:
> Hello
>
> When creating a combobox using a GtkListStore, PHP-GTK gives me this
> error:
>
> (combobox_model.php:7672): GLib-GObject-WARNING **:
> IA__g_object_new_valist: object class `GtkComboBox' has no property
> named `text-column'
>
> Does anyone knows what it can be ? The code is below:
>
> <?php
> $window = new GtkWindow;
> $window->set_default_size(200,100);
> $window->set_border_width(20);
> $window->set_position(GTK::WIN_POS_CENTER);
>
> $model = new GtkListStore(GObject::TYPE_OBJECT, GObject::TYPE_STRING);
>
> $comboBox = new GtkComboBox($model); // => the error is here
>
> $cell_renderer1 = new GtkCellRendererPixbuf();
> $cell_renderer2 = new GtkCellRendererText();
>
> $comboBox->pack_start($cell_renderer1, false);
> $comboBox->pack_start($cell_renderer2, true);
>
> $comboBox->set_attributes($cell_renderer1, 'pixbuf', 0);
> $comboBox->set_attributes($cell_renderer2, 'text', 1);
>
> $items = array();
>
> $items[] = array('ico_pdf.png', 'Arquivo PDF');
> $items[] = array('ico_php.png', 'Arquivo PHP');
>
> foreach ($items as $item)
> {
> $imagem = $item[0];
> $texto = $item[1];
>
> $pixbuf = GdkPixbuf::new_from_file($imagem);
>
> $iter = $model->append(array($pixbuf, $texto));
> }
>
> $comboBox->set_active(0);
> $window->add($comboBox);
>
> $window->show_all();
> Gtk::main();
> ?>
>
definitely a bug, I'll have to take a look later
For now an easy workaround is this
$comboBox = new GtkComboBox();
$comboBox->set_model($model);
does same thing and no error is thrown
Thanks,
Elizabeth