TreeView trouble

Started by jb, February 11, 2010, 02:14:56 PM

Previous topic - Next topic

jb

I'm trying to populate a treeview with a series of folders and subfolders.  I want the key to be the folders actual path, like "c://test//folder01".  When I use this string as the key only the "parent" (or first round) of folders are added.  If I use the same string as the lable "folder01" there are no probelms, but now I can't get the full path to that folder.  Am I making any sense?

Have a look at this and see if something jumps out: i is the full path

Code (autolisp) Select
;(dcl_tree_clear BlockManager_PaletteManager_NavTreeControl)
;;; Populate Tree View ;
;;;(setq dir "c:\\test\\") ;
;;;(setq i "c:\\test\\Folder 01\\Folder01a\\Folder01aa\\") ;
;;;(bm:AddFolders "c:\\test\\")
(defun bm:AddFolders (dir /)
  (setq folderList (bm:GetSubFolders dir))
  (if folderList
    (foreach
           i folderList
      (if (not (= (setq temp (vl-string-left-trim dir i)) ""))
        (progn (setq folder (bm:strParse temp "\\"))
               (cond ((= (length folder) 1)
                      (dcl_Tree_AddParent
                        BlockManager_PaletteManager_NavTreeControl
                        (car folder) i 0 0 1
                        )
                      )
                     ((> (length folder) 1)
                      (dcl_Tree_AddChild
                        BlockManager_PaletteManager_NavTreeControl
                        (cadr folder)(car folder) i 0 0 1
                        )
                      )
                     )
               )
        )
      )
    )
  )


Thanks
James Buzbee
Managing Memeber
Black Horse Development, LLC

Kerry


James,

If you have a look at my code at theSwamp you'll see I populated the tree as required instead of in one pass.

I did this early in my investigation of trees and haven't made time to revisit the code,
but ...

I think populating in one pass will cause unacceptable time delays

and ..
particularly as yours is a palette, any changes to the hosting server file structure and additional documents will not be registered in your tree.

My solution used a modal form so the design considerations are a little different.

I can't make time to look at your code at the moment, but should have some time tomorrow(weekend).
Perfection is not optional.
My other home is TheSwamp

BazzaCAD

Ya I do the same thing, add the sub-folders as they're clicked on.
Doing it all at once took way too long...
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

jb

Thanks Kerry.

I see that as one of the big drawbacks to OpenDCL: dynamic information updating.  I usuallly use a "refresh" buuton, but that's a kludge I  know.  I wish the OpenDCL team (Owen) could introduce some dynamic functionalty for modeless forms . . ..

Barry, I wasn't noticing any time delay with my simple test.  If you guys have some code I could review that could be helpful: thanks.

jb
James Buzbee
Managing Memeber
Black Horse Development, LLC

Kerry


For anyone not familiar with the project code I was referring to :
http://www.theswamp.org/index.php?topic=32058.msg375766#msg375766

James,
my process was :

read the 'Current' folder
  add Child folder names to the tree
  add documents in the 'Current' folder to the list
  display the bitmap from the first document.

rince and repeat as the user selects folders.

Perfection is not optional.
My other home is TheSwamp

owenwengerd

Quote from: jb on February 11, 2010, 04:02:37 PM
I wish the OpenDCL team (Owen) could introduce some dynamic functionalty for modeless forms . . ..

I'm listening, but I'm not sure what you mean by "dynamic functionality".

jb

Owen, lets save that for another time.  What I need right now is the ability to get the path of a folder in a tree control.  So far I can't see how to do that.  I've tried using the path as the key, but the population routine stops at the first row of parents.  If I use the same string for both key and label all folders and subfolders (any depth) are added.

Works:
(dcl_treeview_addchild "root folder" "folder01" "folder01" . . .)

Doesn't work:
(dcl_treeview_addchild "root folder" "folder01" "c://root folder//folder01" . . .)

Is there a method to return the path of a child item in a tree control?

thanks.
James Buzbee
Managing Memeber
Black Horse Development, LLC

jb

Nevermind, found it here http://www.opendcl.com/forum/index.php?topic=657.0

Thanks Jim!  I converted it to look back up the tree using parent instead of sibling: workd great!  :)
James Buzbee
Managing Memeber
Black Horse Development, LLC

owenwengerd

I tested and had no problems adding child nodes with keys such as the one in your example.

jb

Really?  Could you add nodes more than one level deep?  I can add the first level with the key being the path, but adding children to those nodes proved impossible.
James Buzbee
Managing Memeber
Black Horse Development, LLC

owenwengerd

Quote from: jb on February 12, 2010, 11:34:24 AM
Really?  Could you add nodes more than one level deep?  I can add the first level with the key being the path, but adding children to those nodes proved impossible.

I tried it again, and had no problems going three levels deep.