[gtkmm] multiple lines deletion in a ListStore



Hello,
I m still trying to have my multiple lines deletion work, but without any success! :'( i ve tried to do it alone (without asking you more and more for the answers to my problems), but i feel really "blocked" (don t know if this word exists!)

i ve spend time to try to understand how the "get_selected_rows" method works, but maybe it s not sufficient :-/ could you tell me what is wrong in my code? i ve tried several ways but everytime the same seg fault! :p

thanks one more time,
cedric

-----------------------------------------------------------------------------------------------------
in the .hh:

...

   Gtk::TreeView billArray;

   Glib::RefPtr<Gtk::ListStore> m_refListStore;
   Glib::RefPtr<Gtk::TreeSelection> refTreeSelection;
   Glib::RefPtr<Gtk::TreeModel> m_refListModel;
   Gtk::TreeModel *m_refListModel;        //same error


-----------------------------------------------------------------------------------------------------
in the .cc:

...

//called when we press the button "delete line(s)"
void BillFormat::on_delline_press()
{    refTreeSelection = billArray.get_selection();
std::vector<Gtk::TreePath> listHandlePath = refTreeSelection->get_selected_rows();

std::cout << listHandlePath.size()<< std::endl; //diplays the correct value std::cout << (listHandlePath.at(0)).to_string () << std::endl; //diplays the correct value

Gtk::TreePath tp = listHandlePath.at(0); //maybe this is not correct ?!? std::cout << tp.to_string() << std::endl; //diplays the correct value

Gtk::TreeIter iter;
iter = m_refListModel->get_iter(tp) ; // THIS LINE PROVOQUES A SEG FAULT //m_refListModel is a *TreeModel, tp is a TreePath, but "m_refListModel->et_iter(tp);" fails.


/*    const Glib::ustring azer("1");
   iter = m_refListModel->get_iter(azer) ;*/

row = *(m_refListStore->erase(iter));
}
-----------------------------------------------------------------------------------------------------





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