Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MFC Control embedded inside tree control

Posted on 2007-11-14
6
Medium Priority
?
1,633 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 45

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 45

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 2000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

885 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