Text in a Tree View

I have a program that displays a splitter window (very similar to Windows Explorer) and in the left pane, I have a tree view of a hard disk structure.  What I would like to do is place a value next to each entry in this tree (what will be the space of all files under that directory) in response to a menu choice.  I can get it to display it initally, with the following logic:
*User Selects Auto Mode
*Finds the values for each entry in order from top to bottom
*As it goes, it displays the value by using CTreeCtrl::GetItemRect() to figure out the co-ordinates, and then uses TextOut() to display the text.  
My PROBLEM is that whenever something happens, like clicking on another directory or resizing the window, I loose all the data.  As I figure out the data, I put it into a large array for the sake of keeping it, and I thought I could use the virtual  CView::OnDraw() function to re-display it.  Well, this functions never gets called.  What should I use?  I don't know too much about screen updates as you can see, and I am finding out that I know even less than I thought.  

eyeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

goldsmitCommented:
You need to call UpdateAllViews() or UpdateView() from within your document class.  This will tell the view that the data has changed and it needs to update itself.  This is the common method for the document to communicate its changes to the view.  You might want to optimize the UpdateView() call by selecting just a portion to update if performance is an issue.  You should look at these functions in the Visual help for more information.
0
eyeAuthor Commented:
for clarification's purposes (I might be a bit repetative here), I am using Microsoft Visual C++ 4.0 with MFC 4.0.  I am trying to display text in the same AREA as the tree view, but not strictly PART of the tree (in other words, the tree control doesn't know about it)
0
LeoVCommented:
You --DO-- have to overwrite OnDraw() function of your tree view. To get it called when user changes something on the screen, you can call InvalidateRect().
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eyeAuthor Commented:
I could not seem to get InvalidateRect() to work properly for me, so I tried calling the OnDraw function manually, which SEEMS to work.  Very strange though, I put a few message box's in the source as an indication of where in the OnDraw() function the program was, and WITH one of the message boxes in it, the function works properly.  When I take it OUT, I no longer get the correct results.  When the MessageBox() line is commented out, it does NOT display all the information, but it DOES display it correctly when the MessageBox() function is hit.
Here is the entire OnDraw() function:

void CDSView::OnDraw(CDC* pDC)
{
      CDSDoc* pDoc = GetDocument();
      ASSERT_VALID(pDoc);
      
      if(m_bAutoMode == TRUE)
      {
            MessageBox("Start Draw");
            CRect rect;
            HTREEITEM hItem;
            CString strTemp;
            UINT nItems = m_adwAutoMode.GetSize();

            hItem = GetTreeCtrl().GetFirstVisibleItem();
            for(short x = 0; x < nItems; x++)
            {
                  GetTreeCtrl().GetItemRect(hItem,&rect,TRUE);
                  strTemp.Format("%u",m_adwAutoMode.GetAt(x));
                  strTemp = InsertCommas(strTemp);
                  pDC->TextOut( (rect.right + 20),
                        rect.top,strTemp);
                  strTemp.Empty();
                  hItem = GetTreeCtrl().GetNextSiblingItem(hItem);
                  if(hItem == NULL)
                        break;
            }
            
      }


}

This seems to work correctly.  (If this is too hard to read, email me at daniel@ktb.net  and I will send it that way)

HELP!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.