Thread: Update collapsing a CTreeView

  1. #1
    Registered User mepaco's Avatar
    Join Date
    Aug 2002
    Posts
    47

    Update collapsing a CTreeView

    I'm pretty new to this and I don't really understand an easy way to get the different classes in my MFC app talking to each other. Right now I am very confused as to how to get my App class to interact with my view class and such. My immediate question is, I'm using UpdateAllViews() to get my CTreeView to populate itself but each time it is called, any expanded nodes are collapsed. Is there any way to stop it from doing that?

    If anyone just feels like typing or are bored I have a better question for you. How do I make everything talk to each other? Let me set it up. I have a basic MFC generated Windows Explorer type program giving me 1) an App class 2) a MainFrm 3) a Doc 4) a Splitter 5) a CTreeView and 6) a CListView. I have to get a lot of information in the background when the program starts. As new information becomes available I need to add that group of nodes to the TreeView. Right now I start a new thread in my App class after everything is visible. I used extern to give my MainFrm class access to my App class. It uses a Timer to periodically check the App variables and uses the following statement to add get the TreeView to update itself:
    ((CDocument*)GetRightPane()->GetDocument())->UpdateAllViews(stuff...)

    Is there a better way to communicate between these things. It seems like an awful bad way to do it. Please let me know if you have any suggestions or would like to see source.

  2. #2
    Registered User mepaco's Avatar
    Join Date
    Aug 2002
    Posts
    47
    Okay, I managed to get around the whole collapsing thing. I moved the code for the Timer to the CTreeView (seems like such an easy solution now). But if anyone would like to comment on my general problem or point me in the right direction I would appreciate it.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    MFC Objects communicate via messages. Send messages.

    Here is an excellent reference, by Andreas Masur, to message sending via handles.

    http://www.codeguru.com/FAQS/FAQ-A01.html

    Kuphryn

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Polymorphism; Update functions and accessibility
    By CaptainMaxxPow in forum C# Programming
    Replies: 2
    Last Post: 04-23-2009, 08:48 AM
  2. SQLite not performing update
    By OnionKnight in forum C Programming
    Replies: 0
    Last Post: 01-21-2009, 04:21 PM
  3. July 9 2008 MS XP Update
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 07-18-2008, 05:14 AM
  4. ListView Refresh, Update
    By de4th in forum C++ Programming
    Replies: 1
    Last Post: 12-23-2006, 09:13 AM
  5. WARNING: Mass critical update!
    By anonytmouse in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 10-17-2003, 09:44 AM