Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CHeaderCtrl in a CTreeView or CListView

Posted on 1997-06-11
4
Medium Priority
?
371 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 300 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

715 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