Re: [gtkmm] going crazy with the multipe selection with Gtk::TreeSelection



You don't need to. The parameter is provided by selected_foreach() when it calls your callback function, and it will be an iterator that points to the current selected row. This is how your code can work on each selected row in turn.


arfff!!! yes, it was the problem! :p


I'd suggest reviewing the sections of the gtkmm tutorial/book on signals and callbacks, as this kind of parameter passing in signals is very common, so if you don't understand it you will end up banging your head on things for a while yet.

once my headache is passed, i ll go read it! ;-)

So really your connection code needs to be

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

And your callback:

void BillFormat::selected_row_callback(Gtk::TreeModel::iterator &iter) {
  Gtk::TreeModel::Row row = *iter;
  row = *(mrefListModel->erase(iter));
}

Which should work, although I'm sure there's a slightly more elegant way to delete all selected rows. I'll check in my own code that does this later, if I remember.


ok thanks a lot!
cedric




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