Re: Tree, CTree



On Wed, 15 May 2002, Emil Perhinschi wrote:

got to the Tree and CTree widgets in the tutorial ...

can somebody enlighten me which are the differences
between them? There are a lot of cross-references in
the tutorial in those chapters and I got confused ...

What can one do with a CTree and cannot do in Tree,
and the other way around?

besides the obvious difference that CTree has multiple columns besides the
tree itself, there are some more important differences:

CTree is much more configurable, just as CList is much more configurable
than List. There is more built-in functionality, like drag'n'drop reordering
and opened/closed branch pixmaps.

the CTree contains CTreeNode objects, each one of them can have as many
children CTreeNode's (subtrees) as you want. on the other hand, Tree
contains only TreeNode widgets, each of which can optionally have one child
- another Tree widget, with its own TreeNode children. the good part with
the Tree setup is that you can have a TreeNode have a Tree child, which will
make it expandable but without children, while in CTree you must ALWAYS have
at least one child in an subtree. also i could not find a way to get a list
of a CTreeNode's children, while for a Tree you can easily get the subtree
of a TreeNode and its children.

one more important difference is that CTreeNode is not a widget - it is an
opaque structure. you can't do any of the fun stuff you can do with widgets,
like connecting to signals and such. the columns of the CTree are text only,
except the tree itself which can be text only or text and pixmaps, but you
still don't get any widgets even for the pixmaps, they are rendered by the
CTree widget. on the other hand, TreeNode contains just a normal widget, so
you can put whatever you want there - entry box, hbox with several widgets,
anything you like. you can't do that in a CTree - only text and optional
pixmap.

lanzz
--
$_=q<$_=q<,>;s/,/$_/;print;>;s/,/$_/;





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