CFrameWnd::SetActiveView()

This is a discussion on CFrameWnd::SetActiveView() within the Windows Programming forums, part of the Platform Specific Boards category; I have a valid CRichEditView pointer that I retrieved by doing this from within my CMainFrame class: CWinApp::GetNextDocTemplate(...);// to get ...

  1. #1
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856

    Question CFrameWnd::SetActiveView()

    I have a valid CRichEditView pointer that I retrieved by doing this from within my CMainFrame class:
    CWinApp::GetNextDocTemplate(...);// to get the CDocTemplate
    CDocTemplate::GetNextDoc(...);// to get the CRichEditDoc
    pRichView = CRichEditDoc::GetView();// to get the CRichEditView
    then finally:
    CMainFrame::SetActiveView(pRichView);

    I have two huge problems:
    1) it doesn't make the view active (actually, nothing happens)
    2) when I exit the app, i get the standard winXP "Application has encountered a problem and needs to close. We are sorry for the inconvenience." send error report dialog...

    What am I doing wrong??? The view that I retrieve from GetView() is valid... Should I do more than just the line SetActiveView() ?

  2. #2
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Anyone have a clue?

  3. #3
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    I figured out a way around it and just wanted to update in case anyone else ever runs into this...
    What I was trying to accomplish was this: In an MDI app I have a docking bar with a list of output from a compiler. If there are errors or warnings, you can double click on them and the file with the error will open and the line with the error will be selected (similar to how VC++ works). My problem was that if there were more than a single file open and the file double-clicked on was under another one in the window, I couldn't get it to pop up on top of the others.
    I accidentally figured out how to accomplish this. Before, I would open the file if it wasn't already open, otherwise I was trying to pop it on top with SetActiveView(). Now, I am just calling OpenDocumentFile() regardless of whether or not it is already open. If it is not open, it opens it; if it is already open, it is pushed to the top of the zorder.

    Hope this helps someone else...

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21