Solved

Get Child Level in CTreeCtrl

Posted on 2000-05-08
3
759 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 31

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 31

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Pressing cancel button with C# UI Automation 3 51
difference between String.subString() and String.subSequence() 6 169
lucky13 challenge 11 120
Problem to open Excel file 15 95
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

914 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

17 Experts available now in Live!

Get 1:1 Help Now