Author Topic: ( TREEVIEW ) - Is the item selected the last child?  (Read 3514 times)

0 Members and 1 Guest are viewing this topic.

Guest

  • Guest
( TREEVIEW ) - Is the item selected the last child?
« 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.

BazzaCAD

  • Guest
Re: ( TREEVIEW ) - Is the item selected the last child?
« Reply #1 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

Guest

  • Guest
Re: ( TREEVIEW ) - Is the item selected the last child?
« Reply #2 on: October 09, 2007, 02:55:34 PM »
Thanks.... I'll give it a shot.