在CDockablePane中没有收到像ON_WM_LBUTTONDBLCLK()这样的消息 [英] not getting messages like ON_WM_LBUTTONDBLCLK() in CDockablePane
问题描述
我使用vs2010向导制作了一个应用程序,并创建了一个导航窗格,该窗格会生成一个名为CFileView
的可停靠窗口CDockablePane.
一切正常,我可以右键单击虚拟菜单项中的项,并获得对OnContextMenu的回调
但是我想双击打开文件,所以我在消息映射中放入ON_WM_LBUTTONDBLCLK(),在声明消息映射中放入"afx_msg void OnLButtonDblClk(UINT nFlags,CPoint point);",并为OnLButtonDblClk
这通常工作得很好,它可以双击,但是由于某些原因我无法解决,当我双击窗口中的文件名时,它拒绝调用我的OnLButtonDblClk.
这应该是相当基本的东西,我不知道为什么它不起作用.我真的很想帮忙,谢谢
顺便说一句,我已经尝试过上下鼠标左键,但它们也不起作用,它似乎阻止了鼠标左键单击,但是ON_WM_CONTEXTMENU即鼠标右键就可以了.
i made an app using the vs2010 wizard and created a navigation pane which generates a dockable window CDockablePane called CFileView
all works well and i can right click on the items in the dummy menu items and get a callback to OnContextMenu
but i want to open the file with a double click so i put ON_WM_LBUTTONDBLCLK() in the message map and ''afx_msg void OnLButtonDblClk( UINT nFlags, CPoint point );'' in the declare message map and made a body for OnLButtonDblClk
this normally works just fine, it catches double clicks, but for some reason i cannot work out, it refuses to call the my OnLButtonDblClk when i double click the file name in the window.
this should be fairly basic stuff and i have no idea why its not working. i would really love some help, thanks
BTW i''ve tried left mouse up and down and they don''t work either, its seems to be blocking left mouse click but ON_WM_CONTEXTMENU i.e. right mouse is fine.
推荐答案
更新
我将以下内容添加到我的课程中
update
i added the following to my class
BOOL CFileView::PreTranslateMessage(MSG* pMsg)
{
switch (pMsg->message)
{
case WM_LBUTTONDBLCLK:
OnFileOpen();
break;
}
return CDockablePane::PreTranslateMessage(pMsg);
}
PreTranslateMessage就像您期望的那样看到WM_LBUTTONDBLCLK,但我仍然不知道为什么它没有让它回调OnLButtonDblClk
从PreTranslateMessage调用open似乎可以,但是我知道那不是应该去的地方
the PreTranslateMessage is seeing the WM_LBUTTONDBLCLK as you would expect but i still do not know why its not making its way to callback OnLButtonDblClk
calling open from PreTranslateMessage seems to work ok but i know that is not where it is supposed to go
这篇关于在CDockablePane中没有收到像ON_WM_LBUTTONDBLCLK()这样的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!