Solved

CHeaderCtrl in a CTreeView or CListView

Posted on 1997-06-11
4
343 Views
Last Modified: 2013-11-20
I have a number of CTreeViews and would like to add a CHeaderCtrl above them similar to Explorer (I have a splitter also). It would be nice to be able to add the control within the view so that it resizes with the splitter automatically. Is there an example availble? I'm using 4.2.
0
Comment
Question by:martinevans
  • 2
  • 2
4 Comments
 

Expert Comment

by:dustg
ID: 1302058
I am looking to do something similar...

I think a custom view may be required, dervied from CTreeView with an embedded CTabCtrl somehow or with a TabCtrl and CTreeCtrl.  

I have seen this type of functionality with docking windows.  

0
 

Author Comment

by:martinevans
ID: 1302059
Edited text of question
0
 

Accepted Solution

by:
dustg earned 100 total points
ID: 1302060
Instead of using a tree view, use a form view and
attach a CTreeCtrl.  Also add the CHeaderCtrl .  You
can do this via the resource editor, but I recommened
doing it all in memory (create the control, call a
Create in the view's init function using 'this' as the CWnd).
To make sure the controls are resized properly, do something
similar to the following in the view's OnSize() function:

 if ( IsWindow( this->m_hWnd) && IsWindow( m_pTabCtrl->m_hWnd ) && IsWindow( m_pActiveTree->m_hWnd )  ) {
            VERIFY( m_pTabCtrl->SetWindowPos( &(this->wndBottom),
                l_cRect.left, l_cRect.top, l_cRect.Width(), l_cRect.Height(),
                SWP_SHOWWINDOW ) != 0 );

Do that for both controls.. note that OnSize() is called even
before the controls are attached so be careful to check your
pointers.

0
 

Author Comment

by:martinevans
ID: 1302061
Thanks for the answer, I'll start investigating how easy it will be to convert the existing view over to a form view. I had a feeling it would require a form view.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
GIF file bit manipulation for color change 5 107
method notes when mouse over in eclipse 5 82
zeroFront challenge 7 79
EvenOdd challenge 10 88
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

919 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now