Solved

Change Icon in CTreeView

Posted on 1997-01-18
1
427 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
1 Comment
 

Accepted Solution

by:
amichal earned 100 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
method notes when mouse over in eclipse 5 87
Line meaning 9 88
Dell Alienware Graphics Amplifier Driver for non-Alienware systems 18 351
Work with App store 7 68
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 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