• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1354
  • Last Modified:

CTreeCtrl - highlighting an item

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
psen
Asked:
psen
1 Solution
 
ohellCommented:
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
 
psenAuthor Commented:
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
 
Tommy HuiEngineerCommented:
Use the style TVS_SHOWSELALWAYS to display the selection at all times regardless of whether the control has focus.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now