How do I set a node not to have a parent?
I know how to *create* one without a parent, but not how to reset it.
Anyone?

TIA
Mark
-If more of us acted more sensibly,
d'you think Governments might join in?

Re: Treeview by Roger

Roger
Sun Jan 04 09:33:40 CST 2004

Mark Stanton <mstanton@cix.compulink.co.uk> wrote:
> How do I set a node not to have a parent?
> I know how to *create* one without a parent, but not how to reset it.
> Anyone?


Hi Mark,

Best bet is to a have a node from which all others descend.
This "root" node could simply describe the data represented
in the treeview.
Like ...

Root Node - Nodes.Item(1)
|_Child 1 - Nodes.Item(2)
|_Child 2 - Nodes.Item(3)
|_ Child 2 Item 1 - Nodes.Item(4)
|_ etc

So, if you want to move Nodes.Item(4) up to the "root" level ...

ThisForm.Olecontrol1.Object.Nodes.Item(4).Parent= ;
ThisForm.Olecontrol1.Object.Nodes.Item(1).Root

Otherwise, I think you'll have to Remove the node, then
Add it at the root level.

I haven't explained this very well, have I?

-Roger

> -If more of us acted more sensibly,
> d'you think Governments might join in?

Ummm ... No!




Re: Treeview by Mark

Mark
Sun Jan 04 14:03:53 CST 2004

Hi Roger,

> Otherwise, I think you'll have to Remove the node, then
> Add it at the root level.
>
> I haven't explained this very well, have I?

Perfectly clear, just I hope you're wrong. It would seem odd that "Add"
can do it but nothing else can. However, I tried "NULL", and everything
else I could think of, & that didn't work so p'raps you're right 8-(
Anyone (else) 8-\


> > -If more of us acted more sensibly,
> > d'you think Governments might join in?
>
> Ummm ... No!


I agree the record does suggest that 8-(

Mark


Re: Treeview by Igor

Igor
Sun Jan 04 07:32:25 CST 2004

Hi, Mark!
You wrote on Sat, 03 Jan 2004 21:43:07 GMT:

MS> How do I set a node not to have a parent?
MS> I know how to *create* one without a parent, but not how to reset it.
MS> Anyone?

AFAIK you can't :(
You have to recreate this part of the tree:
- unbind all the childs from this node (temporary bind them to another node)
- remove this node,
- create this node again as root one
- bind all its "former childs" again.

Maybe it will be easier to have one "virtual" node - a kind of superroot,
and bind all the real root nodes to it - then all the task can be easily
done by reassigning Parent reference.

Or look for some other treeview control (you don't say, but I suppose you
refer to MS Treeview control).

--
WBR, Igor



Re: Treeview by Mark

Mark
Tue Jan 06 14:54:08 CST 2004

In article <OVRZr$80DHA.2528@TK2MSFTNGP09.phx.gbl>, Igor Korolyov wrote:

> Hi, Mark!

Hiya!


> Or look for some other treeview control (you don't say, but I suppose you
> refer to MS Treeview control).

Yes you're right, the MS one.


> AFAIK you can't :(

Bugger!


> You have to recreate this part of the tree:
> - unbind all the childs from this node (temporary bind them to another node)

Wouldn't it be easier to

recreate the node
move the original children over to the newly created version
delete the old one

?
It would also save going back to the source of the tree (disk), no?


> Maybe it will be easier to have one "virtual" node - a kind of superroot,

Yes, but wouldn't look right I'd say...

Ta very much
Mark
-If more of us acted more sensibly,
d'you think Governments might join in?