Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » How can I put a CSplitterWnd onto the CExtControlBar? Collapse All
Subject Author Date
wa haha Feb 24, 2005 - 8:42 PM

Hi:


    I will use the pro-uis package for our package, and now I am trying to use the trial version to test.. now the problem comes, How can I put the CSplitterWnd onto the CExtControlBar?


My solution: Create a CMySplitterFrame from CFrameWnd, then put it into the CControlBar, it works...


                   But when I replace the CControlBar with the CExtControlBar, it can’t work.. ??  so.. what’s going on??


class CViewBar : public CExtControlBar
{
 DECLARE_DYNAMIC(CViewBar);
public:
 CViewBar();
 virtual ~CViewBar();
    virtual BOOL Create(
  CWnd* pParentWnd,   // mandatory
        CRuntimeClass *pViewClass, // mandatory
  CCreateContext *pContext = NULL,
  LPCTSTR lpszWindowName = NULL,
  DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP,
  UINT nID = AFX_IDW_PANE_FIRST);


 
protected:
 CCreateContext m_Context;
 CFrameWnd *m_pFrameWnd;
 
// Overrides
 // ClassWizard generated virtual function overrides
 //{{AFX_VIRTUAL(CViewBar)
 public:
 //}}AFX_VIRTUAL


    //{{AFX_MSG(CViewBar)
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
 afx_msg void OnSize(UINT nType, int cx, int cy);
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
};


CViewBar::CViewBar()
{
 ZeroMemory(&m_Context, sizeof(m_Context));
 // Create a frame object.
 CRuntimeClass *pRuntimeClass = RUNTIME_CLASS(CFrameWnd);
 CObject* pObject = pRuntimeClass->CreateObject();
 ASSERT( pObject->IsKindOf( RUNTIME_CLASS( CFrameWnd ) ) );
 m_pFrameWnd = (CFrameWnd *)pObject;
}


BOOL CViewBar::Create(
 CWnd* pParentWnd,
 CRuntimeClass *pViewClass,
 CCreateContext *pContext,
 LPCTSTR lpszWindowName,
 DWORD dwStyle,
 UINT nID)
{
 ASSERT(pViewClass != NULL);
 ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CWnd)));
 if (pContext)
  memcpy(&m_Context, pContext, sizeof(m_Context));
 else {
  CFrameWnd *fw = (CFrameWnd *)AfxGetMainWnd();
  if (fw) {
//   cc.m_pCurrentDoc = fw->GetActiveDocument();
   m_Context.m_pCurrentFrame = fw;
  }
 }
 m_Context.m_pNewViewClass = pViewClass;
 return TViewBarBase::Create(
  lpszWindowName,
  pParentWnd,
  nID,
  dwStyle);
}


class CMySplitterFrame : public CFrameWnd
{
 DECLARE_DYNCREATE(CMySplitterFrame)
protected:
 CMySplitterFrame();           // protected constructor used by dynamic creation


// Attributes
public:
 CSplitterWnd  m_wndSplitter1;
// Operations
public:


// Overrides
 // ClassWizard generated virtual function overrides
 //{{AFX_VIRTUAL(CMySplitterFrame)
 protected:
 virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
 //}}AFX_VIRTUAL


// Implementation
protected:
 virtual ~CMySplitterFrame();


 // Generated message map functions
 //{{AFX_MSG(CMySplitterFrame)
  // NOTE - the ClassWizard will add and remove member functions here.
 //}}AFX_MSG
 DECLARE_MESSAGE_MAP()
};

Shailesh Nikam Jan 18, 2007 - 10:07 PM

Can you share the project or can you copy paste all the files here once again.

Technical Support Feb 25, 2005 - 3:24 AM

You told that you were trying to create the CMySplitterFrame window inside CExtControlBar but in your post we cannot see any code that creates the CMySplitterFrame window specifying a resizable control bar as its parent window. Could you send us your project so that we can help you?

wa haha Feb 27, 2005 - 11:54 PM

/ MySplitterFrame.cpp : implementation file
//


#include "stdafx.h"
#include "SDI.h"
#include "MySplitterFrame.h"
#include "TestFormView.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


/////////////////////////////////////////////////////////////////////////////
// CMySplitterFrame


IMPLEMENT_DYNCREATE(CMySplitterFrame, CFrameWnd)


CMySplitterFrame::CMySplitterFrame()
{
}


CMySplitterFrame::~CMySplitterFrame()
{
}



BEGIN_MESSAGE_MAP(CMySplitterFrame, CFrameWnd)
 //{{AFX_MSG_MAP(CMySplitterFrame)
  // NOTE - the ClassWizard will add and remove mapping macros here.
 //}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CMySplitterFrame message handlers


BOOL CMySplitterFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
 // TODO: Add your specialized code here and/or call the base class
 m_wndSplitter1.CreateStatic(this, 2,1);
 m_wndSplitter1.CreateView(0,0,RUNTIME_CLASS(CTestFormView),CSize(800,300), pContext);
 m_wndSplitter1.CreateView(1,0,RUNTIME_CLASS(CTestFormView),CSize(800,300), pContext);


// return CFrameWnd::OnCreateClient(lpcs, pContext);
 return TRUE;
}


 


 


#if !defined(AFX_MYSPLITTERFRAME_H__56F38788_27C9_4DFF_9287_63198166A1F3__INCLUDED_)
#define AFX_MYSPLITTERFRAME_H__56F38788_27C9_4DFF_9287_63198166A1F3__INCLUDED_


#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MySplitterFrame.h : header file
//


/////////////////////////////////////////////////////////////////////////////
// CMySplitterFrame frame


class CMySplitterFrame : public CFrameWnd
{
 DECLARE_DYNCREATE(CMySplitterFrame)
protected:
 CMySplitterFrame();           // protected constructor used by dynamic creation


// Attributes
public:
 CSplitterWnd  m_wndSplitter1;
// Operations
public:


// Overrides
 // ClassWizard generated virtual function overrides
 //{{AFX_VIRTUAL(CMySplitterFrame)
 protected:
 virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
 //}}AFX_VIRTUAL


// Implementation
protected:
 virtual ~CMySplitterFrame();


 // Generated message map functions
 //{{AFX_MSG(CMySplitterFrame)
  // NOTE - the ClassWizard will add and remove member functions here.
 //}}AFX_MSG
 DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.


#endif // !defined(AFX_MYSPLITTERFRAME_H__56F38788_27C9_4DFF_9287_63198166A1F3__INCLUDED_)

Technical Support Mar 1, 2005 - 6:37 AM

Your code looks absolutely correct. So, to clarify why splitters do not work properly, we need to take a look at your project.