TreeNode.EnsureVisible question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • schaf

    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.Ind ex].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.EnsureVisi ble();

    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
  • Peter Duniho

    #2
    Re: TreeNode.Ensure Visible question

    On Tue, 08 Apr 2008 08:11:42 -0700, schaf <schaf@2wire.ch wrote:
    [...]
    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.EnsureVisi ble();
    >
    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

    Comment

    Working...