[gtkmm] adding widgets to TreeView column cells



I created a treeview following the "TreeView - Editable Cells" example in the book.
I can do that ok. What I can't figure out how to do is add and instantiate 
TreeModelColumn's that aren't types like bool, int, and ustring. For example: 
how could one add a label or radiobutton? Is this even possible?

thanks.


ex:

normally you have:
  //Tree model columns:
  class ModelColumns : public Gtk::TreeModel::ColumnRecord
  {
  public:

    ModelColumns()
    { add(m_col_id);}

    Gtk::TreeModelColumn<unsigned int> m_col_id;
  };

then later:
  row[m_Columns.m_col_id] = 1;


So I try (as an example that actually compiles):
  Gtk::TreeModelColumn<Gtk::Label*> m_label;
then later: 
 row[m_Columns.m_label]= new Gtk::Label::Label("Hi"); 

the label fails to display and gives the following runtime error:
 (lb:29476): GLib-GObject-WARNING **: unable to set property `text' of type `gchararray' from value of type `GtkLabel'


this example is probably not the right way to go about it, but just given to help
you understand what I'm trying to do.





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