Re: TreeView



On Fri, 2006-01-27 at 09:43, Pierre THIERRY wrote:
Scribit Ed Leaver dies 26/01/2006 hora 19:08:
> I frequently want to iterate over every item in a TreeModel in a
> single loop

What you want is to iterate over the list of nodes of the tree, sorted
topologically (or visit topologically the tree). You should maybe take a
look at a tree or graph library, that would kindly do this for you, for
example the BGL or GTL...
Well, not quite. I've bookmarked the BGL and GTL homepages, and thank you very much for their suggestion, to which I will certainly refer when next I need the power of a full-blown graph library. But for my present application I do not: the full power of Gtk::TreeStore/TreeView does suffice. And Gtk::TreeMode::foreach_iter(slot & etc...) does in fact iterate over the list nodes of the TreeModel sorted topologically --- how else could one implement it?

A rhetorical question :-) There is also the not-unimportant question of coding philosophy: adding a library such as BGL or GTL gains one a lot of additional power, but that power comes at a price. And that price involves personal time to learn to use the additional library, time to maintain the additional library in one's build environment, and time dealing with the bugs that inevitably infest any large body of code. So there is a trade-off. And if one really needs that kind of power -- and in a previous incarnation as an EDA hack I surely did -- then fersure such investment in time and code is worthwhile. But just for a full-tree iterator over a Gtk::TreeStore, which has critically-desirable GUI display attributes of its own? When I've already demonstrated (and used) a simple dozen-line solution that actually does the job, if not quite as cleanly and efficiently as might be desired,  but does it nonetheless? Well, there is a reason I brought the matter up only in an "Obligatory Dirty-Wish-List" postscript :-)

But once again, I also thank you for the time and thoughtfulness of your reply. No, I'm not going to invest in BGL or GTL right now. But future projects -- who knows? So thanks!

Sincerely,
Ed Leaver

Topologically,
Nowhere man


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