How many more times do you plan to repost this question? We have explained why this will not do what you want, and given some suggestions for finding an alternative approach. Please try some of those suggestions for yourself.
Yes, it could work, but not like you tried above ... think that m_CView is the same CView instance on every tab, which is impossible ... but you can try to create a new instance on every AddView call, something like that:
this is simplistic approach, that I wrote it just you see the point, but in a real situation, you have to elaborate this: create any instance of CYourView object you need, add every one of them in an array of pointers, and supply this pointers on AddView call as first argument. Do you understand what I say ?
And the solution that I just give you is more as you see why your approach is not working than to be applied in your application ... because the creation of your CYourView is not that simple ... they must be attached at you CDocument, and so on ...
Because you have problems in completing your task, this reveal that your approach is not right ... you have to think to another ...
Based on user selection, the graphics on the CView should change. On this CView i will load some Active X control to render the graphics on this window.
If i create multiple CViews with new object, then i have to load the Active X Control on each CView which is a costly operation and memory increases and it not a good way to deal as there are many issues with memory, performance and other areas in my application.
Thats why i want multiple tabs with one single view to solve my issue.
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?