Click here to Skip to main content
Click here to Skip to main content

TreeCtrl - A WTL tree control with Windows Vista style item selection

By , 9 Apr 2006
 

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

AlanW
United Kingdom United Kingdom
Member
Alan has been developing applications for a very long time (~10 years), but he's not bitter about this at all. My main area of expertise is C++. He lives in Sweden with his beautiful wife, daughter and son and enjoys climbing mountains and kayaking in his spare time (which isn't much).

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Questionwhy i can not download the sample code?memberasdf112212 Nov '12 - 22:47 
QuestionSetWindowThemememberSXJIAKE31 Aug '12 - 0:11 
Question不能用啊???memberzhangjingfei21 Jan '10 - 0:52 
AnswerRe: 不能用啊???memberSXJIAKE31 Aug '12 - 0:01 
GeneralOnLButtonUp is not called correctlymemberJinXu24 Apr '08 - 5:15 
Generalfatal error RC1015: cannot open include file 'atlres.h'.memberaditya raut18 Sep '07 - 15:58 
QuestionVC6membertoddma26 Jun '07 - 9:54 
AnswerRe: VC6membertoddma26 Jun '07 - 9:56 
GeneralMake the tree items editablemembershaohao5 Aug '06 - 5:52 
GeneralFixes for keeping selection when clicking expand and collapse and setting background colormemberJ Chris Davies19 Apr '06 - 7:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 10 Apr 2006
Article Copyright 2006 by AlanW
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid