Solved

Get Child Level in CTreeCtrl

Posted on 2000-05-08
3
746 Views
Last Modified: 2013-11-20
during drag and drop operations parent items should stay parent items, child items should stay child items, grandchildren should stay grandchildren, etc, etc. For that i want get the indentLevel of the item like

      int nDragIndent = GetIndentLevel(m_hDragItem);
      int nDropIndent = GetIndentLevel(m_hDropItem);

       if (nDragIndent == nDropIndent)
      {
            // add after the drop item, as child of drop item's parent
             htiPosition = m_hDropItem;
             m_hDropItem = GetParentItem(m_hDropItem);
      }

But i don't know how to get Indent Level.It's urgent. Please do help.Thanks in advance

- yesnathan


0
Comment
Question by:yesnathan
  • 2
3 Comments
 
LVL 30

Accepted Solution

by:
Zoppo earned 50 total points
ID: 2788392
Hi yesnathan,

Just step through the parent items somehow like this:

int GetIndentLevel( HTREEITEM hItem )
{
 int level = 0;
 while ( NULL != ( hItem = GetParentItem() ) )
  level++;
 return level;
}

hope that helps,

ZOPPO
0
 
LVL 30

Expert Comment

by:Zoppo
ID: 2788394
sorry, a typo ... should be:

while ( NULL != ( hItem = GetParentItem( hItem ) ) )
0
 

Expert Comment

by:yesnathan22
ID: 2791142
Hello brother Zoppo,
     i do the same thing it's work well.Thank you very much for your help.I am beginer in VC++.Some times i may need your help.so i want keep in touch with you.Can you please give me your email id.my id yesnathan22@usa.net my messanger id is yesnathan_2000(in yahoo messanger) i am looking forward from you.Bye.

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now