Re: Gtk3 combos



Hmm, I normally run with:

my $list = Gtk3::ListStore->new(qw/Glib::Int Glib::String/);
$list->insert_with_values(0,0,0,1,"Test");
$list->insert_with_values(1,0,1,1,"Test2");

my $combo = Gtk3::ComboBox->new_with_model_and_entry($list);
$combo->set_entry_text_column(1);

Which is why I wrapped that into the no longer existent ComboBoxEntry method:

sub Gtk3::ComboBoxEntry::new
{
    my ($class,$store,$index) = @_;
    my $combo = Glib::Object::Introspection->invoke (
    $_GTK_BASENAME, 'ComboBox', 'new_with_model_and_entry',$class, $store);
    if(defined($index)) { $combo->set_entry_text_column($index); }

    return($combo);
}

Terence J. Ferraro


On Wed, Apr 30, 2014 at 2:16 AM, Daniel Kasak <d j kasak dk gmail com> wrote:
More migration questions ...

A simple example of inserting 2 key/value pairs into a combo, and setting the text column to the 2nd ( Glib::String ) column as the 'display' column used to be:

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

$model->set(
    $model->append
  , 0, 100
  , 1, "Netezza"
);

$model->set(
    $model->append
  , 0, 200
  , 1, "Teradata"
);

my $widget = $self->{builder}->get_object( "CONFIG.TARGET_DB_TYPE" );
$widget->set_model( $model );
$widget->set_text_column( 1 );


How would you do this in Gtk3? If I change the Gtk2 to Gtk3, and rename set_text_column to set_entry_text_column, I get *nothing*. If I add another column to the ListStore ( so we'd have ID, short_text, long_text ), I get the long_text values showing up. So I assume there is something else I'm supposed to be passing to $model->set? Or am I way off?

Dan

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list




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