Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - GetActiveView
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

GetActiveView

 Post Reply Post Reply
Author
Message
JamesC View Drop Down
Newbie
Newbie


Joined: 03 December 2003
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote JamesC Quote  Post ReplyReply Direct Link To This Post Topic: GetActiveView
    Posted: 12 April 2004 at 1:58pm
I am using GetActiveView to determine what view in the docking pane has focus. Everything works fine as long as the panes are docked. but if they are floating then GetActiveView does not find the panes. The parent has changed. I am wondering if there is a better way to determine what view has focus.

What i currently ended up doing was to first get the active view and then check to see if the view is the "main" view. if it is the "main" view, then get the focus (which is either the pane or the "main" view). it just seems like alot of steps.

here is the code...

CView *pActiveView = pDoc->m_pFrame->GetActiveView();
CWnd *pActiveFocus = NULL;
if (pActiveView->IsKindOf(RUNTIME_CLASS(CMyView)))
{
    pActiveFocus = pDoc->m_pFrame->GetFocus();
    if ((pActiveFocus != pActiveView) &&
        (pActiveFocus->IsKindOf(RUNTIME_CLASS(CView))))
    {
      pActiveView = dynamic_cast<CView*>(pActiveFocus);
    }
}
Back to Top
ipaqlinux48 View Drop Down
Newbie
Newbie
Avatar

Joined: 31 March 2004
Location: Belgium
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote ipaqlinux48 Quote  Post ReplyReply Direct Link To This Post Posted: 23 April 2004 at 8:43am

I've experienced another problem. When my view is undocked, the menubar of my main window won't react om mouseclicks. Finally, I've solved this by inserting the next piece of code:
int CMyView::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
{
    // TODO: Add your message handler code here and/or call default
    return CWnd::OnMouseActivate(pDesktopWnd, nHitTest, message);
}
I hope it fixes your problem.

But now I have another problem. When my view is undoced, it seems that it is disconnected from my document. I'll let you know something if I have fixed this problem. In the meantime, good luck with your problem.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.219 seconds.