Solved

MFC Control embedded inside tree control

Posted on 2007-11-14
6
1,508 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
Comment Utility
0
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
Splitter window - similar to window explorer?
0
 

Author Comment

by:DJ_AM_Juicebox
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
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
Comment Utility
>>>> 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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
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.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now