Solved

CHeaderCtrl in a CTreeView or CListView

Posted on 1997-06-11
4
341 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
Comment Utility
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
Comment Utility
Edited text of question
0
 

Accepted Solution

by:
dustg earned 100 total points
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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 gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 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

11 Experts available now in Live!

Get 1:1 Help Now