Re: Gtk2::ComboBoxEntry error on change




Fabio A Mazzarino said:
 When I select an item at a filled Gtk2::ComboBoxEntry I receive the
following error:

 Gtk-CRITICAL **: gtk_entry_set_text: assertion `text != NULL' failed
at guiSaturn.pm line 144.

The ComboBoxEntry is trying to set the text of the entry from the item you
selected, but that text is NULL.  See below.


 guiSaturn.pm line 144 is the Gtk2->main; method call.

This means the error is occurring deep in the library, usually as a result of
you setting something up incorrectly.  :-/


 I'm using Gtk2::GladeXML to build the window, and the following code
to fill the Gtk2::ComboBoxEntry:

         my $store = Gtk2::ListStore->new('Glib::String');
        foreach my $schedRef ( @{$response->value}) {
                $store->set($store->append, 0, $schedRef->{'JOB_NAME'});
        }

        # renderer
        my $render = Gtk2::CellRendererText->new;
        $cmbJobName->pack_start($render, 0);
        $cmbJobName->set_attributes($render, text => 0);

This is unnecessary -- ComboBoxEntry sets up a text renderer by default (or at
least it did in my test code).


        # assign list to combo
        $cmbJobName->set_model($store);

         # tell the ComboBoxEntry which column of the model contains
         # the text to display in the Entry.
         $cmbJobName->set_text_column (0);



-- 
muppet <scott at asofyet dot org>




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