Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by hanspr (Sexton)
on Jan 31, 2020 at 06:12 UTC ( [id://11112157]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11112157]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-23 10:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found