2008-02-01 09:54 UTC
Hello,
I have problem with Lisp code, maybe someone can to help me...
In OnInitialize I have:
(dcl_Tree_Clear bik_Bloki_frmBloki_TreeControl11)
(dcl_Tree_AddParent bik_Bloki_frmBloki_TreeControl11
(list (list "Cars" "C1")
(list "Animals" "A1")
(list "Plants" "P1"))
);
(dcl_Tree_AddChild bik_Bloki_frmBloki_TreeControl11
(list (list "C1" "Os" "C1.1")
(list "C1" "Tr" "C1.2")
(list "C1" "Cm" "C1.3"))
);
etc. etc.
But I need this TreeControl to fill up folders with automatically (μ-recursive function)
For example:
1. start folder: Location = "c:/Bloki/"
2. function code:
3. where I shoud to add this: (dcl_Tree_AddParent ...) and (dcl_Tree_AddChild ...) in the code?
In my disk the folder trees look like:
c:\Bloki\Cars\
c:\Bloki\Cars\Os
c:\Bloki\Cars\Os\S1
c:\Bloki\Cars\Os\S1\S1.1
c:\Bloki\Cars\Os\S1\S1.2
c:\Bloki\Cars\Os\S1\S1.1\... deep and deep
c:\Bloki\Cars\Os\S2
c:\Bloki\Cars\Os\S3
c:\Bloki\Cars\Tr
c:\Bloki\Cars\Tr\T1
c:\Bloki\Cars\Tr\T2
c:\Bloki\Cars\Tr\T2\T2.2\.... deep and deep
c:\Bloki\Cars\Cm
....
etc.
I have problem with Lisp code, maybe someone can to help me...
In OnInitialize I have:
(dcl_Tree_Clear bik_Bloki_frmBloki_TreeControl11)
(dcl_Tree_AddParent bik_Bloki_frmBloki_TreeControl11
(list (list "Cars" "C1")
(list "Animals" "A1")
(list "Plants" "P1"))
);
(dcl_Tree_AddChild bik_Bloki_frmBloki_TreeControl11
(list (list "C1" "Os" "C1.1")
(list "C1" "Tr" "C1.2")
(list "C1" "Cm" "C1.3"))
);
etc. etc.
But I need this TreeControl to fill up folders with automatically (μ-recursive function)
For example:
1. start folder: Location = "c:/Bloki/"
2. function code:
(defun MakeFTree (Location / DirList Path AllPath LstTL)
(defun MakeDirList (Arg / TmpList)
(cond
(
(setq TmpList (cddr (vl-directory-files Arg nil -1)))
(setq DirList (append DirList (mapcar '(lambda (z) (strcat Arg "/" z)) TmpList)))
(foreach Item TmpList (MakeDirList (strcat Arg "/" Item)))
(setq LstTL (cons TmpList LstTL))
)
);end cond
);end MakeDirList
(cond
((= (type Location) 'STR)
(if (member (substr Location (strlen Location) 1) (list "/" "\\"))
(setq Location (substr Location 1 (1- (strlen Location))))
);end if
(MakeDirList Location)
))
);end MakeFTree
3. where I shoud to add this: (dcl_Tree_AddParent ...) and (dcl_Tree_AddChild ...) in the code?
In my disk the folder trees look like:
c:\Bloki\Cars\
c:\Bloki\Cars\Os
c:\Bloki\Cars\Os\S1
c:\Bloki\Cars\Os\S1\S1.1
c:\Bloki\Cars\Os\S1\S1.2
c:\Bloki\Cars\Os\S1\S1.1\... deep and deep
c:\Bloki\Cars\Os\S2
c:\Bloki\Cars\Os\S3
c:\Bloki\Cars\Tr
c:\Bloki\Cars\Tr\T1
c:\Bloki\Cars\Tr\T2
c:\Bloki\Cars\Tr\T2\T2.2\.... deep and deep
c:\Bloki\Cars\Cm
....
etc.