Solved

MFC Control embedded inside tree control

Posted on 2007-11-14
6
1,560 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
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
Industry Leaders: 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

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
Exception thrown at 0x00007FFD5BC81F28 7 54
Problem with SqlConnection 4 184
gdb doesn't stop on breakpoint 2 110
Work with App store 7 89
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

713 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