Treeview and check-boxes

Discussion in 'Questions (Windows Mobile)' started by BjornF, Jun 26, 2007.

  1. BjornF

    BjornF Active Member Licensed User

    Dear All,

    I am struggling with the tree view, in many ways it is very nice but not very easy to understand (for me)... I have constructed a tree using this sub (see also the jpg file - it's a grocery list if you are wondering:)).

    Sub UpdateTree
    for i=0 to MaxCat-1
    tblData.Filter("Cat LIKE '"&tblCat.Cell("Cat",i)&"'")
    For k=0 to tblData.RowCount-1
    node2.Value = node1.addnewnode(tblData.Cell("Artikel",k))
    if StrLength(tblData.Cell("ToBuy",k))>0 then node2.Checked=True
    End sub

    Once the tree is constructed I will check some of the boxes. After "leaving" the tree and continuing the program I want to find out which boxes have been checked (more precisely the node text for each box which has been checked), but I can't find out how to do this. (At the time of checking the boxes tv.action is not raised and so cannot be used.)

    Any ideas on how to do this?

    all the best / Björn

    Attached Files:

    Last edited: Jun 26, 2007
  2. specci48

    specci48 Well-Known Member Licensed User

    Hi BjornF,

    you can browse through the tree with this little piece of code

    Sub CheckTree
    For i = 0 To tv.Count - 1
            node1.Value = tv.GetNode(i)
    If node1.Checked = True Then
    ' do something for root
           ' name = node1.Text
       End If            
    For j = 0 To node1.Count - 1
                 node2.Value = node1.GetNode(j)
    If node2.Checked = True Then
    ' do something for Child
          ' name = node2.text
           End If   
    End sub

  3. BjornF

    BjornF Active Member Licensed User

    Excellent !

    thanks Specci48, I'll go off and play with this :sign0162:

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice