Results 1 to 2 of 2

Thread: treeview: checking ALL siblings

  1. #1
    Guest

    Post

    hi there!

    I am working on a project that contains a treeview with a full directory listening in it...

    Now I want the following to happen: when a node (read directory) gets checked, ALL the siblings (read subdirs beneath that dir) should also be checked... Think of it as what happens in many backup programs like NT Backup...

    I already managed to do it with the 'first degree' sibling, but the rest, whaaaaaaa, not really...

    A second question: I am also looking for a simple way to put all the directory names, on a button click, in a list...

    Can anyone help me out?

    Thanx in advance!


  2. #2
    Lively Member
    Join Date
    Jan 1999
    Location
    Lincolnshire, UK
    Posts
    111

    Post

    Try Something like the following code

    private function CheckNodes(TopNode as node)
    dim ThisNode as node
    for each thisnode in treview.nodes
    if thisnode.key<>"MainNode" then
    if thisnode.parent.key=topnode.key then
    thisnode.checked=true
    if thisnode.children>0 then
    checknodes thisnode
    end if
    end if
    end if
    next

    This function assumes that the first node you added has a key of "MainNode".

    All you have to do is call this function on click and it will cascade through each child node. There is probably a quicker way of doing it but I can't be bothered to work it out.

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