Re: [gtkmm] multiple selections on TreeView
- From: Daniel Elstner <daniel elstner gmx net>
- To: Frank Naumann <fnaumann cs uni-magdeburg de>
- Cc: gtkmm-list gnome org
- Subject: Re: [gtkmm] multiple selections on TreeView
- Date: 23 Nov 2002 00:31:38 +0100
Am Fre, 2002-11-22 um 22.56 schrieb Daniel Elstner:
> >
> > For me it looks like I can't call erase in on_remove_selection() as this
> > possible invalidates the iterator. If this is true is there any other way
> > to remove multiple selections? Or I'm tottaly wrong here?
>
> Yes, that's right. It's a limitation of the underlying GTK+ interface.
> You have to do something along these lines:
[...]
Uhm, that was nonsense. Sorry.
Of course you can't store the paths just like that since they would
point to different rows if you remove a row (paths use indices).
Possible solutions would be:
a) use TreeRowReference objects (complicated)
b) sort the list of paths and remove the rows in reversed order from
bottom to top (simple, since Gtk::TreePath has operator<())
c) call get_selected()->selected_foreach() multiple times and remove the
first selected iter/path in each iteration (complicated, since
selected_foreach() unfortunately doesn't support the boolean return
value "continue", like TreeModel::foreach() does)
I'd go for b). The sorting should be quite simple -- just call
selected_.sort() and use reverse iterators. I reckon b) is the fastest
way too.
Sorry for misleading you,
--Daniel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]