Solved

CHeaderCtrl in a CTreeView or CListView

Posted on 1997-06-11
4
354 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iSeries FTP Exit Program 8 174
sum13 challenge 24 150
Making an alias 7 122
Windows shortcut location resolution on double click open 4 78
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.

752 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