Overridden to set the view class before calling theįor an SDI application the main frame window is created ZeroMemory(&m_Context, sizeof(m_Context)) ĬRuntimeClass *pRuntimeClass = RUNTIME_CLASS(CFrameWnd) ĬObject* pObject = pRuntimeClass->CreateObject() ĪSSERT( pObject->IsKindOf( RUNTIME_CLASS( CFrameWnd ) ) ) īEGIN_MESSAGE_MAP(CViewBar, TViewBarBase) IMPLEMENT_DYNAMIC(CViewBar, TViewBarBase) ViewBar.cpp: implementation of the CViewBar class. ClassWizard generated virtual function overridesĪfx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct) Īfx_msg void OnSize(UINT nType, int cx, int cy) You must #define this for viewbar to compile properlyĭWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP, ViewBar.h: interface for the CViewBar class. That way you don't have to derive eight billion different classes just to use a docking view. I just let MFC do all the work by passing the class type through to it. (A frame window is just needed to support MFC, it doesn't matter what kind.) The creation andĪlso taken care of, is specification of the view class in the create member function. This class encapsulates the frame window so you don't have to know it even exists. (#define TViewBarBase to the base class you need). I created a new CViewBar class that inherits from one of the CSizingControlBar classes. What I am explaining is a way of incorporating a view into a sizing control bar object. (The example does allow the views to be linked to This is a complex topic and highly application dependant and I feel it is better left to the particular application to resolve. Note I'm not describing how to deal with multiple views on multiple documents and how to link these together and manage them. For what I need it for it turns out to be relatively easy. I read in one of the comments that a few people have tried using a frame window to aid the MFC framework in order to use views. Unfortunately, I really needed to use them with views, and set about investigating this. I like Cristi Posea's implementation of sizing docking control bars and decided to use them in a project I am working on. Views in a Sizeable Docking Control Bar (CSizingControlBar)
0 Comments
Leave a Reply. |