Solved

MFC Control embedded inside tree control

Posted on 2007-11-14
6
1,582 Views
Last Modified: 2013-12-14
I want to have something that looks like a tree control but when I expand a branch, it shows a list control instead of just text.  
0
Comment
Question by:DJ_AM_Juicebox
[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
6 Comments
 
LVL 19

Expert Comment

by:alb66
ID: 20280955
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 20281158
Splitter window - similar to window explorer?
0
 

Author Comment

by:DJ_AM_Juicebox
ID: 20281479
in the codeguru article, it looks like one big list control. When I expand an item, I want a new list control, with its own header.
0
Technology Partners: 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!

 
LVL 44

Expert Comment

by:AndyAinscow
ID: 20282011
Do you want something like the visual studio IDE - where you get a popup with parameters/methods etc?  (The super duper tooltip thingy)
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 20282808
>>>> When I expand an item, I want a new list control, with its own header.
Something like a multi-column droplist of a combobox?

I don't know (think) that it looks good. If the left side is a tree you need place for all levels what would limit the place for the listcontrol(s). Of course you could create new list controls and place them right to the selected tree item. but if you have a new header line for each of the list controls, the right part would  look somewhat strange. Do you want to have more than one list control opened at a time? I assume yes, cause otherwise an explorer like view would be better (and would be the 'normal' way).

>>>> I want to have something that looks like a tree control
Is it a control or a view you want to have?
Do you want some (all) features of normal tree/list controls, e. g. showing mini icons, individual scrolling, 'editable' fields, or only the look-and-feel ?

The problem is that the height of a list or tree item couldn't be changed for the standard controls(as far as I know). Hence, you can't make that the control would look like

  Tree          List Controls

  + X
      -   Y       [  A                B                  C     ]
           |       | ...                ...                ....    |    
           |       | ...                                   ....    |
           |       |                    ...                        |
           |       ---------------------------------------
       +  Z      [  D               E       ]
                   | ...                ...                      
       
when using standard tree control, cause you can't change the height of the 'Y' line in the tree so that it spans more than one line.

So at least you would have to make your own tree control which can expand the way you need and have statndard list controls at the right side.

*OR*

you are using a standard 'owner' draw list control as a base (1 big column only), derive your own class from CListCtrl and make all drawing regarding tree lines and sub list controls, including the event handling yourself. Such a control only would look like a tree control plus list controls but actually is nothing better than a 'tabbed' and scrollable list box fully owner drawn.

Regards, Alex
   
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 500 total points
ID: 20311753
It's an interesting idea for a control -- but I could not find example code that does exactly that.  This might not be as hard as it seems at first glance.  You would set up to do custom draw:

    Developing Custom Draw Controls in Visual C++
    http://www.microsoft.com/indonesia/msdn/customdraw.aspx

You can find code that does that, for instance, here:

   Multi-Column Tree View
   http://www.codeguru.com/cpp/controls/treeview/multiview/article.php/c3985/

Your modification would be to not do any of the header stuff in that example.  Instead, when you get the notification for the size of the control, you pick an arbitrarily-high rectangle (perhaps based on the number of items in the list).  Then when asked to display the tree item, you create and populate a CListCtrl (in Report View format) and display it.  You could hide it when the tree item closes (so you could redisplay it later without the create/destroy overhead).

It would take from several days to a week to work out the specifics -- far too much time to do it here (for no pay) but it seem perfectly do-able.
0

Featured Post

Technology Partners: 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

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
In this post we will learn different types of Android Layout and some basics of an Android App.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

623 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