Solved

problems with inserting items in  CTreeView

Posted on 2002-05-18
3
198 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

728 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