Link to home
Start Free TrialLog in
Avatar of mmcgurl
mmcgurl

asked on

TTreeview Parent

Hi,
 I am using a ttreeview component.
 I have many parent nodes each of which
 has four child nodes. My question is
 how can I determine the parent node
 of each child in a way that will not
 produce an exception if the selected
 item is the parent. I am able to
 get the parent when a child node is
 selected, however, if you have the
 parent already selected, the program
 (index) produces an exception. I don't
 really understand ttreeview. Can anyone
 help. (Sorry for rambling!).
 Thanks,
 Michael
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rwilson032697
rwilson032697

Hmmm..

You can check if the parent is assigned like this:

  If Assigned(ANode.Parent) then
    // Do something with the parent

Is this what you want?

Cheers,

Raymond.


Barry,

you answered so fast, it seems you have understood the question. I haven't so please you explain it for me (because I doubt your answer has anything to do with what's asked, but I may be wrong).

Michael,

as you see from my comment fro Barry I have not understood what you want. So I'm just guessing here. Can it be that you want the parent of the selected node and access properties of it (the parent) without ever testing whether the parent is valid? It isn't as hard as it might seem sometimes. If you can formulate your problem then you almost have the solution. Believe me, I have enhanced Delphi's tree view (see TreeNT at www.lischke-online.de) and am currently writing a totally own tree implementation (TVirtualTree). If you have further question then just ask, we can work it out :-)

Ciao, Mike
Aha
well, seems i must have understood  ;-)