65.9K
CodeProject is changing. Read more.
Home

TreeCtrl - A WTL Tree Control with Windows Vista Style Item Selection

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.98/5 (21 votes)

Mar 16, 2006

CPOL
viewsIcon

358612

downloadIcon

3876

A WTL tree control that supports Windows Vista style selection and multiple selection

Introduction

After quite a few requests, I thought I'd post this tree control that uses a similar selection drawing style to the list control I posted here: ListCtrl - A WTL list control with Windows Vista style item selection. For an added bonus, I've also included support for multiple-selection.

How to Use CTreeCtrl

Simply use the tree control as you would the normal CTreeViewCtrl, however there are a couple of functions required to activate and retrieve multiple selections:

void ShowThemed( 
    BOOL bShowThemed = TRUE
)

Description

Draw item selection themed.

Parameters

  • bShowThemed - TRUE = Draw themed selection; FALSE = Classic mode
void SetMultipleSelect( 
       BOOL bMultipleSelect
)

Description

Turns on/off multiple selection.

Parameters

  • bMultipleSelect - TRUE = Turn on multiple select
void GetSelectedItems( 
    CSimpleArray < HTREEITEM >& aSelectedItems
)

Description

Retrieves a list of selected tree items.

Parameters

  • aSelectedItems - Reference to an array of HTREEITEM

Finally

Any comments or suggestions are welcome.

History

  • 16th March, 2006: 1.0
    • First release
  • 20th March, 2006: 1.1
    • Small bug fix for VS2005
  • 5th April, 2006: 1.2
    • Corrected problems with multiple select and checkboxes - many thanks to Phil C.