[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1323
  • 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 HuiCommented:
Use the style TVS_SHOWSELALWAYS to display the selection at all times regardless of whether the control has focus.
0

Featured Post

Industry Leaders: 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!

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