CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2006
    Posts
    28

    CTreeView problem

    Hi all,

    I created a treeview with style

    TVS_HASBUTTONS |
    TVS_DISABLEDRAGDROP |
    TVS_HASLINES |
    TVS_LINESATROOT |
    TVS_CHECKBOXES |
    TVS_SINGLEEXPAND

    When OnInitialUpdate is called, I insert the items into the tree control, everything is fine with inserting the items. But, the problem raises when I set some items to checked state using GetTreeCtrl().SetCheck( hItem, TRUE ). But, it does not show the checked symbol on the item node. Whereas when I query for GetTreeCtrl().GetCheck, it returns me TRUE. I did this in OnInitialUpdate function.

    Regards,

    Salman

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: CTreeView problem

    PostMessage a user defined message (from WM_APP range) from OnInitialUpdate to the treeview itself. Then in this message handler call GetTreeCtrl().SetCheck(...).
    Victor Nijegorodov

  3. #3
    Join Date
    Jan 2006
    Posts
    28

    Re: CTreeView problem

    Hi VictorN,

    Thanks for the reply. But, why I need to post a user defined message.

    Thanks.

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: CTreeView problem

    To fix the problem you have!

    And FYI: the same problem exists for the initial selection in the tree view control; if you call GetTreeCtrl().SelectItem from within OnInitialUpdate (or OnInitDialog in the dialog containing tree control) the selection is NOT displayed.
    Victor Nijegorodov

  5. #5
    Join Date
    Jan 2006
    Posts
    28

    Re: CTreeView problem

    Thanks a lot man for the unthinkable solution

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

Featured