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

x
?
Solved

Hilighting a CTreeCtrl Item

Posted on 2004-08-24
2
Medium Priority
?
650 Views
Last Modified: 2013-11-20
I have a CTreeCtrl. There is an interface to reorder the items in the list. The reordering works fine. I find the selected item, get its data, remove it and reinsert it at the correct spot. After I reinsert the item, I want to select the item that was moved.

I tried:
      m_rasterList.SelectItem(item);
      m_rasterList.SetItemState(item, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
but this doesn't highlight the selected item until you click on the tree again. I also tried calling invalidate but that didn't redraw the tree correctly either.

I also tried
      m_rasterList.SelectItem(item);
      m_rasterList.SetDropTarget(item);
This works till I select another item, then old item stays highlighted but the new one becomes selected.

-Tom
0
Comment
Question by:tcf22
2 Comments
 
LVL 19

Expert Comment

by:drichards
ID: 11888250
Try setting the focus, which is what clicking the tree does:

    m_rasterList.SelectItem(item);
    m_rasterList.SetFocus();
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 500 total points
ID: 11901469
Hi tcf22,

you can even try to assign the style TVS_SHOWSELALWAYS  to the tree control ... this causes the tree control to show selected item
as selected even if it doesn't have the focus.

hope that helps,

ZOPPO
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

873 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