$combo->set_text_column() fails



Can someone tell me what's up with this:

my $model = Gtk2::ListStore->new(
                    'Glib::String',
                    'Glib::String'
                );

foreach my $category (
            [ "body_location",    "Body Location" ],
            [ "breakdown_agency",    "Breakdown Agency" ],
            [ "incident_type",    "Incident Type" ],
            [ "injury_and_disease", "Injury / Disease Type" ],
            [ "injury_consequence",    "Injury Consequence" ],
            [ "injury_location",    "Injury Location" ],
            [ "injury_mechanism",    "Injury Mechanism" ],
            [ "risk_category",    "Risk Category" ],
            [ "risk_score",        "Risk Score" ]
             )
{
    my $iter = $model->append;
   
    $model->set(
            $iter,
            0, $$category[0],
            1, $$category[1]
           );
    print "\n0: " . $model->get( $iter, 0 ) . "\n";
    print "1: " . $model->get( $iter, 1 ) . "\n";
   
}

my $combo = $self->{form}->get_widget("ReportCategory");
$combo->set_model( $model );
$combo->set_text_column( 1 );

At this point, I get:

Gtk-CRITICAL **: gtk_combo_box_entry_set_text_column: assertion
`entry_box->priv->text_column == -1' failed at forms/report_builder.pm
line 146.

But my print statements are finding the right values in the model, and
if I use the model in an auto_completion object, *it* allows me to set
the text column:

my $entry_completion = Gtk2::EntryCompletion->new;
$entry_completion->set_minimum_key_length( 1 );
$entry_completion->set_model( $model );
$entry_completion->set_text_column( 1 );
$combo->get_child->set_completion( $entry_completion );

If I use the entry completion, it also uses the correct values. Why
can't I set the text column for the combo?

Dan




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