Solved

CTreeCtrl - highlighting an item

Posted on 1997-09-30
3
1,282 Views
Last Modified: 2013-11-20
I want to programatically highlight an item in a tree control. I can select it no problem using m_ctlTree.Select( hSelected, TVGN_CARET ) - this expands nodes to display the item, but it is not highlighted. I also tried SetItemState with TVIS_SELECTED but this did nothing.
0
Comment
Question by:psen
3 Comments
 
LVL 1

Expert Comment

by:ohell
ID: 1307258
Select() should normally highlight the item, but you might have the focus on some other control....try setting the focus to the tree control before calling Select()  
0
 

Author Comment

by:psen
ID: 1307259
Thanks for the speedy response - is there any way I can highlight an item without setting focus to the tree - the control is not enabled at this point.
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
ID: 1307260
Use the style TVS_SHOWSELALWAYS to display the selection at all times regardless of whether the control has focus.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sumNumber challenge 16 140
noX challenge 17 134
How to convert MFC::CString to UTF8 wchar_t* 10 388
Problem to Office 1 45
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 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