Announcement

Collapse
No announcement yet.

TVM_SortChildren not working recursively

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

  • José Roca
    replied
    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.

    Leave a comment:


  • Gary Beene
    replied
    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.

    Leave a comment:


  • José Roca
    replied
    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".

    Leave a comment:


  • Gary Beene
    replied
    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.

    Leave a comment:


  • José Roca
    replied
    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".

    Leave a comment:


  • Gary Beene
    replied
    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.

    Leave a comment:


  • Gary Beene
    replied
    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.

    Leave a comment:


  • Michael Mattias
    replied
    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.

    Leave a comment:


  • Gary Beene
    started a topic TVM_SortChildren not working recursively

    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.
Working...
X
😀
🥰
🤢
😎
😡
👍
👎