Re: [gtkmm] Problem with Gdk::Pixbuf in Gtk::TreeView



On Thu, Sep 04, 2003 at 11:52:38PM +0200, Martin Schulze wrote:
> Sorry, I haven't been very clear.
> I meant you should try exactly this but insert the line
> 
> iconcolumn->set_renderer(*imagerenderer, this->columns_set.icon);
> 
> before appending the column to the treeview (I don't know if the
> order matters). This is the way you would set up a column if you
> needed to specify the cellrenderer type explicitly (like e.g. the
> custom cellrenderer type CellRendererList in the examples).

Woooooooooooooooooooooow, it works! Thanks a lot! Even though, I can't
understand why it works now, but I am happy ;-)

The code to add a column for a Glib::RefPtr<Gdk::Pixbuf> looks like this now:

  /* Create renderer */
  Gtk::CellRendererPixbuf *imagerenderer =
      Gtk::manage(new Gtk::CellRendererPixbuf);
  /* Create col */
  Gtk::TreeViewColumn* iconcolumn =
      Gtk::manage(new Gtk::TreeViewColumn("Icon", *imagerenderer));
  /* Add renderer and Gtk::ModelViewColumn to the Gtk::TreeView::Column */
  iconcolumn->set_renderer(*imagerenderer, this->column_set.icon);
  /* Add col to Gtk::TreeView */
  this->tree_view.append_column (*iconcolumn);

Regards,

-- 
Simon Fuhrmann | NightSlayer at gmx.de | http://www.dismember.de
All people talk about the real life, but where can I download it?



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