How to move to next node in TreeView?

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

    How to move to next node in TreeView?

    I want to write code to move to the next node in a TreeView. The code will
    behave similar to when the user presses down arrow. Thanks.


  • Chris Hornberger

    #2
    Re: How to move to next node in TreeView?

    Will that auto-scroll to the out of view items?

    If it doesn't, you can hit the treeView.Nodes with an index and set
    that one to ".EnsureVisible =true" (or is that a method call now?)
    [color=blue]
    >
    > TreeNode.NextVi sibleNode is the property you're looking for.
    >
    > private void NextVisibleNode (TreeView treeView)
    > {
    > treeView.Select edNode = treeView.Select edNode.NextVisi bleNode;
    > }
    >
    > Of course, check for null values etc. in actual code.[/color]

    Comment

    • someone

      #3
      Re: How to move to next node in TreeView?

      NextVisibleNode does not scroll to out of view nodes. Here is part of my
      code:
      // Make sure the children nodes at the currently selected node are visible
      tvwFolders.Sele ctedNode.Expand ();

      // Select the next node in the TreeView
      tvwFolders.Sele ctedNode = tvwFolders.Sele ctedNode.NextVi sibleNode;

      Thanks for the additional tips.


      "Chris Hornberger" <chris@chornbe. com> wrote in message
      news:53ec8913.0 307091241.10013 d11@posting.goo gle.com...[color=blue]
      > Will that auto-scroll to the out of view items?
      >
      > If it doesn't, you can hit the treeView.Nodes with an index and set
      > that one to ".EnsureVisible =true" (or is that a method call now?)
      >[color=green]
      > >
      > > TreeNode.NextVi sibleNode is the property you're looking for.
      > >
      > > private void NextVisibleNode (TreeView treeView)
      > > {
      > > treeView.Select edNode = treeView.Select edNode.NextVisi bleNode;
      > > }
      > >
      > > Of course, check for null values etc. in actual code.[/color][/color]


      Comment

      • someone

        #4
        Re: How to move to next node in TreeView?

        Thanks a lot. I replaced my 20 or so lines of code, which even had a bug
        because it was not recursively looking at parent nodes.


        "bjs10" <sullebay@bells outh.net> wrote in message
        news:583627d0.0 307090550.5102f 506@posting.goo gle.com...[color=blue]
        > "someone" <a@a.com> wrote in message[/color]
        news:<e13R$ldRD HA.704@tk2msftn gp13.phx.gbl>.. .[color=blue][color=green]
        > > I want to write code to move to the next node in a TreeView. The code[/color][/color]
        will[color=blue][color=green]
        > > behave similar to when the user presses down arrow. Thanks.[/color]
        >
        > TreeNode.NextVi sibleNode is the property you're looking for.
        >
        > private void NextVisibleNode (TreeView treeView)
        > {
        > treeView.Select edNode = treeView.Select edNode.NextVisi bleNode;
        > }
        >
        > Of course, check for null values etc. in actual code.[/color]


        Comment

        Working...