[gtkmm] Gtk::TreeView questions



Hello,

I like to have treeview like this:

Name
 Billy
   Son of Billy
   Daughter of Billy
 Susan
   Son of Susan
   Father of Susan
 Mammo
   Gates
   Bla bla bla

Here is my header:
< snip >
Glib::RefPtr<Gnome::Glade::Xml> m_refGlade;
Gtk::ScrolledWindow* m_ScrolledWindow;
Glib::RefPtr<Gtk::ListStore> m_refTreeModel;
Gtk::Button* m_pButton;
Gtk::TreeView* m_tree;

Here is my code:
< snip >
   m_refGlade->get_widget( "treeview1", m_tree );
   if( m_tree )
   {
      m_refTreeModel = Gtk::ListStore::create( m_Columns );
      m_tree->set_model( m_refTreeModel );

      Gtk::TreeModel::Row row = *( m_refTreeModel->append() );

      row[ m_Columns.m_col_name ] = "Billy Bob";

      //Attention
      //The problematic code
      Gtk::TreeModel::Row childrow = *( m_refTreeModel->append(
row.children() );
      childrow[ m_Columns.m_col_name ] = "Son of Rohan";
      //The end

      //childrow = *( m_refTreeModel->append( row.children() ) );

      //childrow[ m_Columns.m_col_name ] = "Daughter of Rohan";

      row = *( m_refTreeModel->append() );

      row[ m_Columns.m_col_name ] = "Sally Belephit";

      row = *( m_refTreeModel->append() );

      row[ m_Columns.m_col_name ] = "Lydia Bradphot";

      //childrow = *( m_refTreeModel->append( row.children() ) );

      //childrow[ m_Columns.m_col_name ] = "Bustard of Lydia";

      m_tree->append_column( "Name", m_Columns.m_col_name );
   }

How do I append the child? I got this error:
treeview.cpp: In constructor `DerivedTreeview::DerivedTreeview(GtkWindow*,
   const Glib::RefPtr<Gnome::Glade::Xml>&)':
treeview.cpp:34: error: no matching function for call to `Gtk::ListStore::
   append(const Gtk::TreeNodeChildren&)'
/usr/include/gtkmm-2.4/gtkmm/liststore.h:173: error: candidates are:
   Gtk::TreeIter Gtk::ListStore::append()
treeview.cpp:34: error: parse error before `;' token
make: *** [treeview.o] Error 1

Thank you.





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