Re: How to delete a multiple selection from a ListStore?



I don't get how your RowReferences method would work, you need a
TreeIter for the erase method, don't you?
My second method does work though; is it terribly inefficient, or do
you think I'll survive? :)

Joost

On 8/8/06, Murray Cumming <murrayc murrayc com> wrote:

> Convert your original list of selected rows into a list of
> Gtk::TreeModel::RowReferences.  Using this list you can use the paths it
> contains when you loop through the list calling the model's erase
> method.  The path each Gtk::TreeModel::RowReference contains remains
> valid so long as the row to which it points exists regardless of the
> fact that you are changing the model by deleting rows.

I've never quite understood the need for this class. A path is already
only a potential path. When you convert it to an iter then the iter will
be invalid if the path isn't valid at that time. (In the example code,
he's not checking the result of get_iter(), I see.)

And if we were just storing paths then the paths wouldn't indicate the
same rows if we have deleted the rows before the intended row.

Maybe RowReference always provides a valid (at the time, sometimes
different than originally) path.


Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com





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