?
Solved

Change Icon in CTreeView

Posted on 1997-01-18
1
Medium Priority
?
433 Views
Last Modified: 2013-11-20
How to change an icon in a CTreeView. I used the following call but the icon does not change from old one to the new.

void CJeopTreeView::ChangeItem(int nStatus)
{
      HTREEITEM hTreeItem = m_treeCtrl->GetSelectedItem();
      
      TV_ITEM TreeCtrlItem;
      
      m_treeCtrl->GetItem(&TreeCtrlItem);
      TreeCtrlItem.mask = TVIF_HANDLE      | TVIF_PARAM;
      TreeCtrlItem.hItem = hTreeItem;

      switch (nStatus)
      {
      case JEOP_RETURNED:
            TreeCtrlItem.iImage = JEOP_RETURNED;
            break;
      case JEOP_COMPLETED:
            TreeCtrlItem.iImage = JEOP_RETURNED;
            break;
      default:
            break;
      }

      BOOL b = m_treeCtrl->SetItem(&TreeCtrlItem);
}

JEOP_RETURNED is an index in the CImageList.

Could someone help out please?

Thanks!

Calvin Chi
chic@aracnet.net
0
Comment
Question by:chic
[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
1 Comment
 

Accepted Solution

by:
amichal earned 200 total points
ID: 1300420
You need to set:

TreeCtrlItem.mask  |= TVIF_IMAGE;
before calling SetItem.

This infroms SetItemt hat the image field is valis
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses

762 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