Solved

MFC Control embedded inside tree control

Posted on 2007-11-14
6
1,539 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
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
unix example issues 18 92
How do I return the Android Studio to its default project window settings? 6 72
Problem to App 4 83
draw a Christmas tree by using a nested loop? 26 63
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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.

825 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