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

OnMouseActivate bug needs documentation

 Post Reply Post Reply
Author
Message
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Topic: OnMouseActivate bug needs documentation
    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.
Adding ON_WM_MOUSEACTIVATE() and
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

Back to Top
Sven View Drop Down
Senior Member
Senior Member


Joined: 21 August 2003
Location: Germany
Status: Offline
Points: 127
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sven Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
Sven View Drop Down
Senior Member
Senior Member


Joined: 21 August 2003
Location: Germany
Status: Offline
Points: 127
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sven Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post 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.

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.156 seconds.