CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2002
    Location
    NJ
    Posts
    3

    CTreeCtrl parent and child

    Hello all,

    I am pretty new to MFC so please bear with me.

    I have a tree view and a listview. I want to be able to drag and drop items from the tree into the list and vice versa.

    Everything is up an running except for:

    1. I want to be able to drag and drop child entries only. The parents should not be dragable.
    What is the best way to implement this?

    2. When I take someting off the list and place it on the tree, I want it to go to a specific place in the tree. For example: Say I had a tree parents car and truck with children door and bumper.
    I can take door off the tree and drop into the list OK. I want to be able to take the item off the list and have it drop on the tree under the correct parent.

    Thanks alot.



    TJ

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: CTreeCtrl parent and child

    >> 1. I want to be able to drag and drop child entries only.

    In OnBegindrag() handler check if ItemHasChildren() returns FALSE. If it doesn't do quit with *pResult = 0.

    >> 2. When I take someting off the list and place it on the tree, I want it to go to a specific place in the tree.

    So do it. Find an item you need and make it a parent for your dropping item.

    Respectfully,

    Igor
    Best regards,
    Igor

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