471,330 Members | 1,111 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

TreeNode.EnsureVisible question

HI NG!
I have a problem which is very confusing for me.
In my app it is possible that the tree view will be cleared and
created completely new.
To provide nice usability i would like to expand all nodes, which were
expanded before the new creation of the tree view.

So I save the first child node of all expanded nodes in a arraylist
and use a clone of this array list after the new creation of the tree
view.

Now my question:
1.) The EnsureVisible function works fine, if i call the EnsureVisible
function like this:

Nodes[0].Nodes[node.Parent.Index].Nodes[node.Index].EnsureVisible();

2.) but it does not work if I obtain my nodes from the arraylist and
call the function directly on this node. Like this:
node.EnsureVisible();

Why is it needed to call the function as described in point 1 ? I
recognized the same behavior with the Expand and ExpandAll functions.

Do you have an hint for a better solution of my problem?

Thanks and regards
Marcel
Apr 8 '08 #1
1 3540
On Tue, 08 Apr 2008 08:11:42 -0700, schaf <sc***@2wire.chwrote:
[...]
2.) but it does not work if I obtain my nodes from the arraylist and
call the function directly on this node. Like this:
node.EnsureVisible();

Why is it needed to call the function as described in point 1 ?
Without actual code, it's impossible to say for sure. But I didn't read
anything in your description that would suggest that your new TreeView
nodes are the same ones you had before. If your new TreeView doesn't
include the same actual TreeNode instances you stored in your ArrayList,
then of course calling EnsureVisible() on the nodes in the ArrayList isn't
going to have any effect (nor the expand methods).

Pete
Apr 8 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Polo | last post: by
4 posts views Thread by Rob Stevens | last post: by
1 post views Thread by jmDesktop | last post: by
1 post views Thread by AAaron123 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.