Solved

Get Child Level in CTreeCtrl

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

680 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