Results 1 to 8 of 8

Thread: TreeView Nodes - Can they be externally instanciated?

Hybrid View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    Question

    Hola peeps,

    Is it possible to instanciate a treeview nodes collection externally from the actual control, build up the tree and then use something like:

    Set TreeView1.Nodes = MyNodes

    to display it?

    I can't think of any way other than to use a second 'invisible' treeview control?

    Anyone?

    (I guess I want to be able to add whoel nodes to a treeview without having to create all the sub-nodes...I want to store my nodes so I don't have to do a complete refresh of my tree-view every time something changes...)



    Dan

    [Edited by Judd on 05-02-2000 at 06:02 AM]

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    Unhappy Anyone know why this doesn't work....

    I thought this might solve the above problem, but apparently not.

    I can't believe there is no way to add complete nodes to a tree....it seems like an obvious thing to want to do

    Code:
    Private Sub Form_Load()
    
        Dim tvw As Object
        Dim nde As Node
        Dim nde2 As Node
        
        Set tvw = CreateObject("MSComctlLib.TreeCtrl")
        
        With tvw
            Set nde = .Nodes.Add(, , "ROOT", "Root Node")
            Set nde = .Nodes.Add("ROOT", tvwChild, "CHILD1", "Child One")
            Set nde = .Nodes.Add("ROOT", tvwChild, "CHILD2", "Child Two")
        End With
        
        Set nde = tvw.Nodes("ROOT")
        
        Set nde2 = TreeView1.Nodes.Add(, , "R", "Tv1 Root")
        
        Set nde.Parent = TreeView1.Nodes("R")
        
    End Sub

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    Talking Hehehehe....just to get this back to the top of the forum ;o)




  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    Talking Once more unto the top dear friends, once more...

    Can I copy a node from one treeview to another or not?

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    Unhappy I wondering if I should've titled this thread 'Horny Chicks' or something....

    Where are the gurus and hyperactive members when you need them?

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    Thumbs down

    I think nobody likes TreeView except me...

  7. #7
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Lightbulb

    There's no direct way to copy everything from TreeView to another with one line of code. You would have to manually loop through nodes collection in one TreeView and populate another. If you need help on coding, just let me know.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    Talking

    Thanks Serge..

    I had figured that there wasn't a way around the problem (which, frankly, is just sh*t on the part of the MS originators!).

    As I mentioned elsewhere (Persistance Is Futile) my preferred route is using an invisible Tree to store my nodes and transfer them as and when to the visible tree (so I don't have to load them every time....)

    I'll be sure to give you a shout though, should I get stuck again..

    Cheers,

    Dan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width