TheSwamp

Code Red => Visual DCL Programming => AutoLISP (Vanilla / Visual) => OpenDCL => Topic started by: Guest on October 09, 2007, 01:42:42 PM

Title: ( TREEVIEW ) - Is the item selected the last child?
Post by: Guest on October 09, 2007, 01:42:42 PM
I've got a tree view control with multiple parents, children and grandchildren?

Anyways... Is it possible to determine if the item selected is the "grandchild" as shown in the image below?
I don't want someone to select the Switches.dwg item or the New, Existing To Remain or Existing To Be Removed items and then click the Insert Device button which would then through an error message.


I hope this makes sense.
Title: Re: ( TREEVIEW ) - Is the item selected the last child?
Post by: BazzaCAD on October 09, 2007, 02:15:13 PM
I think the only way to do it is to loop through the "dcl_Tree_GetParent"

Here's what I do. There's probably extra junk in this example that you wont need.

Code: [Select]
(setq CurrectKey SelKey)
(Setq PathList (list sSelText))

(while (setq ParentKey (dcl_Tree_GetParent TMaCAD_MainTMaCAD_TreeControl CurrectKey))
     (if ParentKey (Setq PathList (append PathList (list (car (dcl_Tree_GetItem TMaCAD_MainTMaCAD_TreeControl ParentKey))))))
     (setq CurrectKey (cadddr (dcl_Tree_GetItem TMaCAD_MainTMaCAD_TreeControl ParentKey)))
   );_ while
Title: Re: ( TREEVIEW ) - Is the item selected the last child?
Post by: Guest on October 09, 2007, 02:55:34 PM
Thanks.... I'll give it a shot.