Making Glade created ComboBox behave like Gtk2::ComboBox->new_text?



Dear list,

in my application I'm using empty ComboBox'es created in Glade, which
are later filled with option values from a database. If the Glade file
contains an empty <property name="items" translatable="yes"> </property>
(this happens if you type a space into the "Items" field in Glade), I
can use append_text() to add the option values to the ComboBox. The
ComboBox then seems to behave like one created with
Gtk2::ComboBox->new_text.

If the items property is missing (default in Glade), this doesn't work
because then the CombBox model isn't initialized.

If I use code similar to

    my $model = new Gtk2::ListStore('Glib::String');
...
    for ... {
        $model->set($model->append, 0, ...);
    }
    $cbox->set_model($model);

this doesn't work either, the cell renderers seem to be messed up. cbox
is the Glade ComboBox widget.

Any ideas? Basically, I want to convert the empty ComboBox to one, where
I can just use append_text().

Martin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]