Announcement

Collapse
No announcement yet.

TVM_SortChildren not working recursively

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    TVM_SortChildren not working recursively

    Has anyone had success with the tvm_sortchildren message working recursively? MSDN says it will but I can't get it to work.

    It says to use the following in message:

    fRecurse Value that specifies whether the sorting is recursive. Set fRecurse to TRUE to sort all levels of child items below the parent item. Otherwise, only the parent's immediate children are sorted.
    I've used

    Code:
    SendMessage hTreeview, %tvm_sortchildren, 0, hNode
    SendMessage hTreeview, %tvm_sortchildren, 1, hNode
    SendMessage hTreeview, %tvm_sortchildren, -1, hNode
    All three sort the first level of children under a parent. The 2nd /3rd do not sort the children at any other level - which I thought would work.

    #2
    Try using TVM_SORTCHILDRENCB and keep track of everything you get in your callback procedure (just dump to a file). That may tell you something.

    Or maybe... the child node needs to be expanded or it does not sort?

    Then again... no compilable demo or even data examples to replicate problem is shown.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


      #3
      Here's the example. Button press sorts the selected node - and supposedly children too. But 2nd level children are not sorted. Expanded or not, didn't make a difference.

      Code:
       #Compile Exe
       #Include "Win32API.inc"
       #Include "CommCtrl.inc"
       #Resource "pb-test.pbr"
       Global hDlg As Dword, hTreeView As Dword
       Global hItem As Dword, hTemp As Dword, hTemp2 As Dword
       Function PBMain() As Long
          Dialog New Pixels, 0, "TreeView",200,200,155,170, %WS_SysMenu, 0 To hDlg
          Control Add Treeview, hDlg, 100, "", 10,10,130,125
          Treeview Insert Item hDlg, 100, 0, %TVI_Last, 2,2,"Top" To hItem
          Treeview Insert Item hDlg, 100, hItem, %TVI_Last, 2,4,"Mother" To hTemp
             Treeview Insert Item hDlg, 100, hTemp, %TVI_Last, 2,4,"Dan" To hTemp2
             Treeview Insert Item hDlg, 100, hTemp, %TVI_Last, 1,4,"Bob" To hTemp2
          Treeview Insert Item hDlg, 100, hItem, %TVI_Last, 1,4,"Father" To hTemp
             Treeview Insert Item hDlg, 100, hTemp, %TVI_Last, 2,4,"Helen" To hTemp2
             Treeview Insert Item hDlg, 100, hTemp, %TVI_Last, 1,4,"Any" To hTemp2
          Control Add Button, hDlg, 200, "Sort", 10,140,40,20
      
          Dialog Show Modal hDlg Call DlgProc
       End Function
      
       CallBack Function DlgProc() As Long
       Dim hTreeView As Dword, hNode As Dword
          If Cb.Msg = %WM_Command And Cb.Ctl = 200 Then
                Treeview Get Select hDlg, 100 To hNode
                Control Handle hDlg, 100 To hTreeView
                SendMessage hTreeView, %tvm_sortchildren, 1, hNode
          End If
       End Function
      Last edited by Gary Beene; 4 Apr 2009, 01:35 PM.

      Comment


        #4
        Since tvm_sortchildrencb doesn't do recursive sorting, would its results be of help?

        Try using TVM_SORTCHILDRENCB and keep track of everything you get in your callback procedure (just dump to a file). That may tell you something.

        Comment


          #5
          The documentation says that it "sorts the child items of the specified parent item in a tree-view control."

          "Dan" and "Bob", aren't children of "Top", but of "Mother".
          Forum: http://www.jose.it-berater.org/smfforum/index.php

          Comment


            #6
            Hi Jose,

            I took this MSDN info about the tvm_sortchildren parameters to mean that sorting would recursively walk through children of children. Are you saying that is not what it means?

            fRecurse Value that specifies whether the sorting is recursive. Set fRecurse to TRUE to sort all levels of child items below the parent item. Otherwise, only the parent's immediate children are sorted.

            Comment


              #7
              Are you saying that is not what it means?
              What better proof do you need that seeing that it doesn't do what you think it will do?

              "Dan" and "Bob", aren't children of "Top", but of "Mother".
              Forum: http://www.jose.it-berater.org/smfforum/index.php

              Comment


                #8
                Hi Jose,

                I had also searched the web for various examples. I found a few in C in which the author claimed the sort would be recursive (sort children of children)

                Of course, just because someone else says they get it to work doesn't mean they really did - but it did lead me to believe that the recursive wording meant exactly that.

                And, to your question, working with dialogs doesn't always seem to give the same answer as with non-dialog windows. So perhaps there's a dialog limitation?

                And, again to your question, just because I can't get it to work doesn't lead me to believe that someone else couldn't. This wouldn't be the first time there was some information I didn't have, that MSDN assumed I did, needed to get a message to work right.

                Comment


                  #9
                  The documentation isn't clear to me. To know it for sure the best way will be to try it using SDK. If it sorts all the items, then it could be a DDT issue.
                  Forum: http://www.jose.it-berater.org/smfforum/index.php

                  Comment

                  Working...
                  X
                  😀
                  🥰
                  🤢
                  😎
                  😡
                  👍
                  👎