Re: Suggestions

budman was overheard mumbling something about this on 14 Oct 2000 13:03:59 EDT

On Mon, 09 Oct 2000 01:35:13 +0100, Dermot Musgrove said:

 When I use a dynamically updated CTree 

Thanks for your help.  :)  I was able to get a basic layout.  CTree is much
easier to work with then Tree is.
I've got the list of dirs working, just have to figure out how to do pixmaps
and add subdirs. Is there a way I won't have to traverse each directory and
display it has subdirs?  Sort of making a dynamic directory tree where it
refreshs on the expand signal.

Well, you could do something like this, but it would be kinda hackish... When
you build your tree, put a Folder pixmap in each node that is a directory. In
your user data for the node you should store the path info.   Setup a
"tree_select_node" signal handler. In your signal handler, pull in the user
data, scan that path, and attach the new nodes to the node you just got passed
in the signal call.  Then call the expand signal automagically.  You might want
to do this on the "button_press_event" instead of the "tree_select_node" if you
want to make your users double click on folders to expand them... Up to you...
In that case, you would simply use the $ctree->selection; macro to find the
currently selected node.  Since the first click of a double click will select
the node under the cursor, assuming you don't block that in your
"button_press_event" handler.

So to summarize,  build the lowest level of your tree, with no children, so
nothing will have expansion icons.  But pack folder icons into the nodes that
are folders, so users will know that they can click on em.  Then trap either
the select_node or button_press_event signals... Figure out what node was
selected or clicked, and then get it's user data to find out what path you need
to scan.  Scan that path, attaching these new nodes to the currently selected
node as children.  You can even use the same routine you used to build the tree


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