Print Page | Close Window

OnMouseActivate bug needs documentation

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
Printed Date: 20 August 2022 at 12:52am
Software Version: Web Wiz Forums 12.04 -

Topic: OnMouseActivate bug needs documentation
Posted By: Ark42
Subject: OnMouseActivate bug needs documentation
Date Posted: 10 May 2004 at 12:46pm

In XTPDockingPane.h, the comments above AttachView really should mention that the view you attach absolutely must override the poorly documented MFC message WM_MOUSEACTIVATE and call the CWnd version, in order to bypass the CView version.  If your CView does not do this, then clicking in your docked pane then floating the pane will cause you to not be able to click on any of the menu including the control box and close X button.  If you close the program from the task bar, right click, and pick close, you get debug assertions relating to invalid vtables and such.
void CYOURView::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
    CWnd::OnMouseActivate(pDesktopWnd, nHitTest, message);
will solve all these problems quite nicely.  It took me a lot of digging through GUI_VisualStudio7 sample, which was the only sample that used AttachView for the docking panes, in order to reproduce the problem I was having. Finally when I commented out OnMouseActivate the menus broke like they always had in my program.
No place in the help files or code comments mentions using OnMouseActivate, so it would have been a great help to me, and could be a great help to others in the future, to mention OnMouseActivate in XTPDockingPane.h

Posted By: Sven
Date Posted: 10 May 2004 at 4:46pm
This happens with all views which are used as normal windows, not only with docking panes. The "problem" is that CView::OnMouseActivate sets always the active view in the mainframe.

Posted By: Ark42
Date Posted: 10 May 2004 at 6:25pm

Not sure what you really mean by "normal windows" since "normally" I use a CView with a CFrame and a CDocument, tied together from a CDocTemplate and there is no problem.  Classwizard doesn't even list WM_MOUSEACTIVATE as a common override.  This problem caused me a lot of headache and even if its not specific to codejock, it definately would not hurt anything to mention this next to AttachView()'s comments in order to help us out.

Posted By: Sven
Date Posted: 11 May 2004 at 3:38am

I mean if you use a CView without a CDocument. In the doc/view model the mainframe has a active view and routes the menu commands to it. If you activate another view with the mouse, this view gets a WM_MOUSEACTIVATE and activates itself in the mainframe (with SetActiveView).

One Example: In one of my apps I don't use the doc/view model. The mainframe dispatches the commands to the child window(s). One of the child window is a derived CFormView. If OnMouseActivate is not overridden, the derived CFormView calls SetActiveView in the mainframe and all menu commands are routed to the CFormView instead to the active child window. The derived CFormView is used as a "normal" window here.

Posted By: Ark42
Date Posted: 11 May 2004 at 1:42pm

I actually use CView and CFrame derived classes but CDocument itself as the parameters to CDocTemplates.  I don't actually use the CDocument (its always null) but I still call it the doc/view model, and I havn't run into this problem before trying to use a CView in a docking pane.  Anyway, I'm not saying its neccessarily a bug with the docking panes, but it is something that most people like myself would have to spend a lot of time researching for a fix when ussing docking panes with AttachView() so it would save us all a lot of time to put a simple comment in the header file near AttachView suggesting that the programmer override WM_MOUSEACTIVATE.

Print Page | Close Window

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