Solved

CHeaderCtrl in a CTreeView or CListView

Posted on 1997-06-11
4
348 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 AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Different colored text in ComboBox without Subclassing 8 61
substring method in java 1 123
viewing source code from eclipse 13 108
Unix Command -- Challenging  question 7 92
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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 shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

803 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