Solved

problems with inserting items in  CTreeView

Posted on 2002-05-18
3
184 Views
Last Modified: 2013-11-20
Hi,
I have 2 little problems with CTreeView:

1. I want to give focus to an item when I right click
   I use in the OnRButtonDown the following code
        myTree.Select(htItem, TVGN_DROPHILITE);
   The htItem is selected (inverse video) but the focus is not set to this item...
Any idea on how to give focus to it ?

2. How can I insert an item just after the selected item, not in the beginning, in last position, or in sorted position ??? This is strange to me, how can I insert this just before, or just after the selected item ???

Thanks all
0
Comment
Question by:tradinfo
3 Comments
 
LVL 12

Accepted Solution

by:
migel earned 50 total points
ID: 7018137
Hi!
1. must be
myTree.Select(htItem, TVGN_CARET);
2. myTree.Insert(....., myTree.GetParent(htItem), htItem);
where hItem -  selected item.
to insert item just before you have to check some condition
for example:
if (myTree.GetNextItem(hItem, TVGN_PREVIOUS ))
 myTree.Insert(....., myTree.GetParent(htItem), myTree.GetNextItem(hItem, TVGN_PREVIOUS ));
else
 myTree.Insert(....., myTree.GetParent(htItem), TVI_FIRST);
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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 …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

743 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

11 Experts available now in Live!

Get 1:1 Help Now