Solved

Get Child Level in CTreeCtrl

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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