in reply to Gtk3::SimpleList create personal type with 2 cells in same column

Documenting for any other interested on this.

Is the only way I managed to do make it work.

The concept is to create 3 columns

The first column has to be a user defined column
The 2nd and the 3rd hold the text and icon we want to join
We hide the 2nd and 3rd columns

We create our custom column that joins the 2nd and 3rd Columns

Tried to use Gtk3::CellRenderer as the renderer for the user defined render but it fails.
So had to declare a Textrender, and then clear the column attributes and recreate the attributes again.


Gtk3::SimpleList->add_column_type('image_text', type => 'Glib::Scalar', renderer => 'Gtk3::CellRendererText', attr => sub { my ($treecol, $cell, $model, $iter, $col_num) = @_; my $pixrd = Gtk3::CellRendererPixbuf->new(); my $txtrd = Gtk3::CellRendererText->new(); $treecol->clear(); $treecol->pack_start($pixrd,0); $treecol->pack_start($txtrd,1); $treecol->add_attribute($pixrd,'pixbuf',1); $treecol->add_attribute($txtrd,'markup',2); } ); # Create your model my $slist = Gtk3::SimpleList->new ( 'Text Field' => 'text_icon', 'text' => 'markup', 'icon' => 'pixbuf', ); # Hide text and icon my @col = $slist->get_columns; $col[1]->set_visible(0); $col[2]->set_visible(0);


  • Comment on Re: Gtk3::SimpleList create personal type with 2 cells in same column
  • Download Code