ODCL多层表添加到tree控件
以前在论坛上求过该函数,可是没人回答,目前自己弄出来了,发出来大家交流下。。。。;多层表添加到tree控件(defun odcl_tree_addlist(LST TreeControl / KEY addlist)
(SETQ KEY (dcl_Tree_AddParent TreeControl (list (list(car lst)))))
(defun addlist(lst key / x key1 kl)
(foreach x lst
(if (listp x)
(setq key1 (dcl_Tree_AddChild TreeControl(list (list key (car x))))
kl (addlist (cdr x) key1)
)
(setq key1 (dcl_Tree_AddChild TreeControl (LIST(list key x))))
)
)
);defun addlist
(addlist (cdr lst) key)
(PRINC)
)测试数据:
(setq lst '("总分类"
"A没有子分类"
"B没有子分类"
;POP1
("分类1"
"分类11"
("分类12"
"分类121"
("分类122"
"分类1221"
"分类1222"
"分类1223"
)
"分类123"
"分类124"
"分类125"
"分类126"
"分类127"
)
"分类13"
)
;POP2
("分类2"
"分类21"
"分类22"
"分类23"
"分类24"
"分类25"
"分类26"
)
;POP3
("分类3"
"分类31"
"分类32"
"分类33"
"分类34"
"分类35"
"分类36"
"分类37"
"分类38"
"分类39"
)
)
)
6666666666666
页:
[1]