Print Page | Close Window

GetActiveView

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=617
Printed Date: 04 December 2024 at 2:00pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: GetActiveView
Posted By: JamesC
Subject: GetActiveView
Date 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);
    }
}



Replies:
Posted By: ipaqlinux48
Date 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.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net