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

A Tree List Control

By , 19 Sep 2002
 
<!-- 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

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

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   
QuestionHow to convert the project to "Use MFC in a Static Library"?memberthelastphoenix24-Oct-11 23:45 
GeneralMy vote of 5memberMember 75250315-Sep-11 23:56 
GeneralUnable to Edit the columns.memberMahadev HK4-May-11 15:41 
GeneralRe: Unable to Edit the columns.memberModal sun20-Sep-11 15:30 
GeneralRe: Unable to Edit the columns.memberthelastphoenix16-Nov-11 15:42 
GeneralTuroboDll behaviour in Windows Vista or Windows 7memberMember 115045326-Oct-10 22:38 
Questionhow to add combobox itemsmemberSakhalean3-Aug-10 21:34 
I want to add combo box items to the list control
How to add items to combobox
and where to add combo box items.
 
Pls help me.
AnswerRe: how to add combobox itemsmemberMember 115045326-Oct-10 22:54 
GeneralRe: how to add combobox itemsmemberSakhalean27-Oct-10 17:42 
GeneralRe: how to add combobox itemsmemberdd_dzs10-Apr-11 22:05 
QuestionThe tree list controlmemberYeMeGe20-May-10 11:24 
QuestionHow to solve Bug using ComboBoxmemberuara8229-Oct-09 16:41 
General"A required resource was unavailable"memberNaryoril1-Sep-09 1:19 
Generalfind a bugmember7817537914-May-09 21:24 
GeneralMultiline text inNodememberjatin dave20-Jan-09 21:48 
GeneralCrash in CancelControl() on 64 bit platforms.memberMember 431310519-Dec-08 2:15 
QuestionCrash in CancelModify - after ESCAPE keymemberMember 115045312-Nov-08 23:30 
GeneralFind a text and highlightmembermohadeb14-Oct-08 3:22 
Question跪求,老大这个怎么编译Release版本?membertuhaitao9-Jun-08 19:07 
AnswerRe: 跪求,老大这个怎么编译Release版本?membercnZhangcm26-Mar-09 22:21 
GeneralRe: 跪求,老大这个怎么编译Release版本?memberspaceknight7-Jul-09 17:43 
GeneralRe: 跪求,老大这个怎么编译Release版本?membermaicoye22-Jul-09 21:59 
QuestionCrashed when I Expand All the Items in Release Versionmembermconstor27-Apr-08 19:36 
AnswerRe: Crashed when I Expand All the Items in Release Versionmembermconstor31-May-08 18:26 
Generaltotally useles code for existing controlmemberkilt26-Apr-08 5:00 

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

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130617.1 | Last Updated 20 Sep 2002
Article Copyright 2002 by TigerX
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid