If a window does not display a shortcut menu it should pass this message to the DefWindowProc function. If a window is a child window, DefWindowProc sends the message to the parent. Otherwise, DefWindowProc displays a default shortcut menu if the specified position is in the window's caption.
If you have a context menu (in the parent and/or child) it will be shown before the NM_RDBLCLK handler is called. Then there should be no reason to act upon double clicks too. The message will even not being generated when the mouse is over the meanwhile opened popup menu when the second click occurs.
Yes, I see your point, but I don't have any right click, or contextMenu, or shortcut menu handler neither in CMyView (derived from CFormView), neither in my CTreeCtrl object (IDC_TREE1) ... or, I miss something ?
It is sufficient to comment the message map entries (which should be created too by the wizard).
By the presence of the context menu handler I assumed that you want to use it.
All I can think of is that the NM_RDBLCLK notification is not send by some processing in the default (right mouse button related) MFC CWnd or derivatives handlers.
Another source of not getting the notification might be handling the message in your derived tree control using ON_NOTIFY_REFLECT(). If so, use ON_NOTIFY_REFLECT_EX() instead and return FALSE to get the notification passed to the parent.
No, it won't work!
just because CS_DBLCLKS is not a window style. It is a window class style!
But forget this! Note that double-click in a tree control is used by default to expand/collapse tree items!
So these messages are handled by control itself and therefore you cannot handle them in your code.
You could subclass the Tree Control (in your own class derived from CTreeCtrl).
In the derived class implement the ON_NOTIFY_REFLECT_EX macro to handle left/right double click and then pass (or not) this message for the further handling.
I have a requirement where i need to display few tabs and render something in only one view instead of creating multiple views for each tab. The reason is i am loading an active x control on that view. So, i written class which inherits from CTabView, but When i call AddView(), each AddView() is creating a new object and i need to load active x control on each view which is violating my requirement and unnecessary memory is getting created.
Is there is any way to create only one view for all the tabs, such that i can create only one view and load active x control on that view and switch the tabs to render different things on one view.?
Currently i am trying with tabbedpane assuming my above requirement will get solved.
Please let me know incase if there is any other option?
For Eg: I have a drawing file which internally contains 5 sub drawings in it. So based on no. of sub drawings, i have to create 5 tabs. In each tab each sub drawing should get render. But user is allowed to view only one sub drawing at a time i.e., the active tab drawing. Thats the reason why i need to create tabs.
When i click on first tab, first sub drawing will be displayed. if second tab is selected then second sub drawing should be displayed. like wise rest of the drawing when user selects the tab.
class MyMainClass : public CTabView
int OnCreate(LPCREATESTRUCT lpCreateStruct);
int MyMainClass::OnCreate(LPCREATESTRUCT lpCreateStruct)
if (CTabView::OnCreate(lpCreateStruct) == -1)
class CDrawingView : public CScrollView
/.... rendering logic.
So, each time i call AddView() the CDrawingView class is getting instantiated and new view is getting created. Instead only one view should be available and new tabs should get created.
The whole point of using AddView is to add a new View to the tab group. The documentation (CTabView::AddView[^])
makes it clear that it creates a new View for each call. If you want a single View then you will need to find an alternative to the CTabView control.