Re: Mixed pixbuf and text




On Jul 1, 2005, at 12:27 AM, Beast wrote:

Is there any way to add text next into pixbuf in SimpleList?
Or if it's not possible any way to merge the column header so 2 column (pixbuf and text) has only 1 column header?

Can't do it with SimpleList, but you can with TreeView. Just pack two cell renderers into one column. That means you have to do a bit more work, stuff that the convenience APIs normally do for you.

  # assume that PIXBUF_COLUMN and TEXT_COLUMN refer
  # to the index of the column in the model holding that data.

  $column = Gtk2::TreeViewColumn->new;
  $column->set_title ($column_title);
  $pixbuf_cell = Gtk2::CellRendererPixbuf->new;
  $text_cell = Gtk2::CellRendererText->new;
  $column->pack_start ($pixbuf_cell, FALSE);
  $column->pack_start ($text_cell, TRUE);
  $column->add_attribute ($pixbuf_cell, pixbuf => PIXBUF_COLUMN);
  $column->add_attribute ($text_cell, text => TEXT_COLUMN);



--
Examples really shouldn't include unexploded ordnance.
  -- Joe Smith, referring to an example program i wrote.




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