Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to check if a TTreeNode exist (not deleted) ?

6 views
Skip to first unread message

atiq

unread,
Jul 9, 2008, 3:59:40 AM7/9/08
to

Hello,
i have a TTreeView and insert to that Node's. the adress of inserted Node's i save to a TClientDataSet String field.

i delete a node and after that i try to check with "if (?) then"
is this Node exist.

My Question: how can i do it ?

regards

Remy Lebeau (TeamB)

unread,
Jul 9, 2008, 6:12:02 PM7/9/08
to

"atiq" <a...@hotmail.com> wrote in message
news:48746fec$1...@newsgroups.borland.com...

> the adress of inserted Node's i save to a TClientDataSet String field.

Why are you storing the node's *address* ???? That is a dynamic value. The
next time the app is run, the values will be different.

What EXACTLY are you trying to accomplish?

> i delete a node and after that i try to check with "if (?) then"
> is this Node exist.
>
> My Question: how can i do it ?

Asside from simply setting your pointer to nil when you delete it, about all
you can do is just loop through the entire TreeView checking each node to
see if it matches the value you have.


Gambit


atiq

unread,
Jul 10, 2008, 2:45:48 AM7/10/08
to
Hello,

1. i try to stor the adress temporarly to bind TTreeView with TClientDataSet. I move change or delete any Node and after that i try to insert the Node with the stored adress from TClientDataSet to among an another Node and so on....

2. I also try to check a Node:= Pointer(inttostr(TClientDataSet['StringPointer'])), how i check a Pointer if there is yet valid
?
regards.

Remy Lebeau (TeamB)

unread,
Jul 10, 2008, 1:26:26 PM7/10/08
to

"atiq" <a...@hotmail.com> wrote in message
news:4875b01c$1...@newsgroups.borland.com...

> 1. i try to stor the adress temporarly to bind TTreeView with
> TClientDataSet.

That still does not explain why you are storing the *memory address* of the
TreeNode. That is a completely wrong thing to do. You should be storing
some kind of identifier that is inside the Node's data instead, and then
look up the current Node object for it when needed.

> I move change or delete any Node and after that i try to insert the
> Node with the stored adress from TClientDataSet to among an
> another Node and so on....

There is no guarantee that the adress will still be valid by that time.

> 2. I also try to check a Node:=
> Pointer(inttostr(TClientDataSet['StringPointer'])),
> how i check a Pointer if there is yet valid

I already told you how. You would have to loop through the entire TreeView
one node at a time until you find the address. That is the only safe way to
do it.


Gambit


0 new messages