Re: [Fxruby-users] FXTreeLists....
Status: Inactive
Brought to you by:
lyle
|
From: Hugh S. S. E. E. <hg...@dm...> - 2003-07-08 15:52:16
|
On Tue, 8 Jul 2003, Lyle Johnson wrote:
> Hugh Sasse Staff Elec Eng wrote:
>
> > Looking at the examples for FXTreeLists, there are some things that
> > stand out.
> >
> > Firstly, an item in an FXTreeList is not an FXTreeList, but an
> > FXTreeItem. This seems contrary to customary computer science
>
> It is important not to confuse the FXTreeList widget with a "tree"
> abstract data type.
>
> Every widget in FOX is some kind of window, and FXTreeList must thus be
> a window as well. But it wouldn't make sense for the FXTreeList widget
> to have other widgets (windows) as its children, and that's why the
Well, most of the other widgets have widgets as children, I suppose
it is a design decision.
> FXTreeItem class exists. FXTreeItem is a kind of data object (i.e. it is
> *not* a widget) that the FXTreeList manipulates, and FXTreeItem objects
> have most of the "structural" properties that I think you'd expect to
> see in a tree data type.
except for adding descendants, etc, which actually belong to the
Treelist itself.
>
> > Secondly, FXTreeLists allow [...] "user data" with the object. This
> > data can be any Ruby object, can it?
>
> Yes, right. This makes it more convenient to attach some
> application-specific data to a tree item, in situations when subclassing
> FXTreeItem would be overkill.
Thanks. I think I can make some more progress now.
>
> > I can use the FXTreeList to structure auxilliary data if I wish,
> > without having to have two data structures to keep in synch. Is
> > that correct?
> Yes, that's also true.
>
> > Thirdly, once I start manipulating the data held in each
> > FXTreeItem, if I wish to expand items below it for example,
> > [...]how is this sort of thing normally handled?
> I think most people just hang on to a reference to the tree list
OK, it seemed a bit messy that way, but...
> [...] For that matter, I don't suppose
> there's a problem with sticking a reference to the tree list in
> that bundle of user data that you attach to the tree items.
...that seems a good place to hide this sort of bird's nest wiring :-)
>
>
Thank you,
Hugh
|