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

A Tree List Control

, 19 Sep 2002
Rate this:
Please Sign up or sign in to vote.
A Tree List Control
<!-- Add the rest of your HTML here -->

Introduction

This is a class derived from CWnd class. It's a tree control with a list.

Features

Below are some of the many features that CTreeListCtrl has:

  • Compatible with CTreeCtrl & CListCtrl
  • Header drag & drop
  • Drag & drop between CTreeListCtrl
  • Transparent drag window with Alpha blend
  • Double colors of list
  • Background image
  • Check box support
  • Lock box support
  • Embedded modified controls
  • No more in future

Snapshot 1

Snapshot 2


How to use it

Add this string into stdafx.h
#include "..\\TurboDLL\\xTurboDll.h"

Define your controls

class CMyTreeListCtrl : public CTreeListCtrl  
{
public:
  CMyTreeListCtrl();
  virtual ~CMyTreeListCtrl();

protected:
  //{{AFX_MSG(CMyTreeListCtrl)
  afx_msg void OnExpanding(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnExpanded(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnUpdating(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnUpdated(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnBeginDrag(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnDragEnter(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnDragLeave(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnDragOver(NMHDR* pNMHDR, LRESULT* pResult);
  afx_msg void OnDrop(NMHDR* pNMHDR, LRESULT* pResult);
  //}}AFX_MSG

  DECLARE_MESSAGE_MAP()
};

Use your controls

class CTurboDragDlg : public CDialog
{
// Construction
public:
  CTurboDragDlg(CWnd* pParent = NULL);   // standard constructor
        ...
  CImageList  m_ImageList;
  CMyTreeListCtrl  m_tree1;
  CMyTreeListCtrl m_tree2;
        ...
};

CTurboDragDlg::OnInitDialog() 
{
  CDialog::OnInitDialog();
  
  // TODO: Add extra initialization here
  m_ImageList.Create( IDB_BITMAP_TREE, 16, 4, 0xFF00FF );

  CRect rect;
  GetClientRect(&rect);
  rect.DeflateRect( 5, 5, 5, 5 );

  CRect left;
  left = rect;
  left.right = ( rect.left + rect.right ) / 2;

  CRect right;
  right = rect;
  right.left = ( rect.left + rect.right ) / 2;

  m_tree1.Create( 0x50810000, left, this, 0 );
  m_tree2.Create( 0x50810000, right, this, 1 );

        // Add other initialize code here
        ...
        
        return TRUE;  // return TRUE unless you set the focus to a control
  // EXCEPTION: OCX Property Pages should return FALSE
}

Then use it freely.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

TigerX
Web Developer
China China
He is a Visual C++ developer, MCSE
He has been programming in C/C++ for 7 years, Visual C++ with MFC for 5 years and RDBMS: Oracle, MS SQL for 5 years

Comments and Discussions

 
AnswerRe: how to add combobox items PinmemberMember 115045326-Oct-10 23:54 
GeneralRe: how to add combobox items PinmemberSakhalean27-Oct-10 18:42 
GeneralRe: how to add combobox items Pinmemberdd_dzs10-Apr-11 23:05 
QuestionThe tree list control PinmemberYeMeGe20-May-10 12:24 
QuestionHow to solve Bug using ComboBox Pinmemberuara8229-Oct-09 17:41 
General"A required resource was unavailable" PinmemberNaryoril1-Sep-09 2:19 
Generalfind a bug Pinmember7817537914-May-09 22:24 
GeneralMultiline text inNode Pinmemberjatin dave20-Jan-09 22:48 
GeneralCrash in CancelControl() on 64 bit platforms. PinmemberMember 431310519-Dec-08 3:15 
QuestionCrash in CancelModify - after ESCAPE key PinmemberMember 115045313-Nov-08 0:30 
GeneralFind a text and highlight Pinmembermohadeb14-Oct-08 4:22 
Question跪求,老大这个怎么编译Release版本? Pinmembertuhaitao9-Jun-08 20:07 
AnswerRe: 跪求,老大这个怎么编译Release版本? PinmembercnZhangcm26-Mar-09 23:21 
GeneralRe: 跪求,老大这个怎么编译Release版本? Pinmemberspaceknight7-Jul-09 18:43 
GeneralRe: 跪求,老大这个怎么编译Release版本? Pinmembermaicoye22-Jul-09 22:59 
QuestionCrashed when I Expand All the Items in Release Version Pinmembermconstor27-Apr-08 20:36 
AnswerRe: Crashed when I Expand All the Items in Release Version Pinmembermconstor31-May-08 19:26 
Generaltotally useles code for existing control Pinmemberkilt26-Apr-08 6:00 
GeneralRe: totally useles code for existing control PinmemberKochise1-Oct-08 7:51 
Questionthe Combobox control cannot be dropdown when use together with TreeListCtrl in a same dialogbox [modified] Pinmemberdoublestone8-Apr-08 3:51 
QuestionCan we use the code freely? PinmemberMember 461932710-Dec-07 15:12 
QuestionCan you not show expansion boxes on leaf items? PinmemberSteve_Harris15-Nov-07 0:45 
AnswerRe: Can you not show expansion boxes on leaf items? Pinmemberahrdmy harmy8-Mar-09 21:52 
QuestionHow to include TurboDLL staticaly into a project [modified] PinmemberKochise9-May-07 22:16 
AnswerRe: How to include TurboDLL staticaly into a project Pinmembernet_id1-Jan-09 20:58 
Generalin-list editing of subitem PinmemberMike Eriksson13-Apr-07 0:49 
GeneralRe: in-list editing of subitem PinmemberMike Eriksson13-Apr-07 22:53 
GeneralRe: in-list editing of subitem PinmemberMr.SeYeu6-Jul-08 17:11 
QuestionSorting? PinmemberLittleIan3-Apr-07 2:02 
QuestionSortChildren PinmemberJordan Walters2-Apr-07 13:24 
GeneralCan't include in my .NET 2003 project!! PinmemberKhanafer24-Nov-06 7:20 
QuestionHow to implementation Print list item? Pinmembertangversion15-Oct-06 21:33 
Generali can't add it in asp.net control(VB code) PinmemberPhan Thanh Lam8-Oct-06 18:56 
GeneralRe: i can't add it in asp.net control(VB code) PinstaffChristian Graus8-Oct-06 20:05 
QuestionSet color in subitems Pinmembercatia_wapf3-Aug-06 3:20 
AnswerRe: Set color in subitems Pinmembertangversion15-Oct-06 21:29 
GeneralCan´t delete columns... Pinmembervertex_x17-Apr-06 2:44 
QuestionHow to print? Pinmembertangversion27-Mar-06 20:05 
GeneralLot of Flicker when Resizing PinmemberBagul Buva8-Mar-06 12:58 
QuestionFind a bug when moving colums Pinmemberochoteau8-Dec-05 0:59 
AnswerRe: Find a bug when moving colums Pinmemberhoker.ffb28-Jun-06 21:57 
General@TigerX Pinmemberyokosuna30-Nov-05 20:08 
GeneralDone it, done that... PinmemberKochise20-Jan-06 5:56 
GeneralThanks alot ... Pinmemberyokosuna27-Jun-06 1:19 
GeneralWell, hrem... PinmemberKochise4-Jul-06 23:13 
GeneralSolved ! Pinmemberyokosuna5-Sep-06 5:09 
GeneralRe: Done it, done that... PinmemberSteve_Harris20-Nov-07 4:39 
GeneralRe: Done it, done that... PinmemberCODE-VCPP19-Feb-09 6:24 
GeneralRe: Done it, done that... PinmentorHans Dietrich3-Nov-10 5:24 
GeneralRe: Done it, done that... Pinmemberskyformat99@gmail.com12-Aug-12 21:01 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141223.1 | Last Updated 20 Sep 2002
Article Copyright 2002 by TigerX
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid