[gtkmm] problem with selection and TreeView



Hello,

I have a window which contains some buttons. If I click on one of those buttons, a window with a treeview inside is opened. I allow multiple selections. But when I run the code, I have this "warning" :

(main:3118): Gtk-CRITICAL **: file gtktreeselection.c: line 426 (gtk_tree_selection_selected_foreach): assertion `selection->tree_view->priv->model != NULL' failed

Thanks for your help,

Karim.




void Monitor::on_button_click()
{

...

ModelColumns *m_Columns;
 m_Columns = new ModelColumns;

 Gtk::TreeView *m_TreeView;
 m_TreeView = Gtk::manage(new Gtk::TreeView);

 Glib::RefPtr<Gtk::TreeStore> m_refTreeModel;
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_TreeView->get_selection();

 refTreeSelection->set_mode(Gtk::SELECTION_MULTIPLE);

refTreeSelection->selected_foreach(SigC::slot(*this, &Monitor::selected_row_callback) );
...

/*
//Fill the TreeView's model
...
*/
}

void Monitor::selected_row_callback(const Gtk::TreeModel::iterator& iter)
{
 cout << "Monitor::selected_row_callback" << endl;
}







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