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 » Resizable Dialogs in a tab container Collapse All
Subject Author Date
Jeremy Ruth Nov 2, 2007 - 4:07 PM

Is this possible? I will have 2 (or more) resizable dialogs based on dialog resource templates that I want to put into a dockable tab container.

I have looked at the Tabbedbars example and have tried to duplicate exactly what is being done there, but no matter what I do, my dialogs come up in a non-tabbed state.

Ulrich Heinicke Nov 4, 2007 - 4:00 AM

Hi,
i have got a solution for a problem like yours. The solution insert resizable dialogs into tab containers in splitt views. Maybe i will help you to solve your problem.

This is the mainfrm.h:

// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MAINFRM_H__C2F3DFCE_230E_49E9_A640_98AC283D471A__INCLUDED_)
#define AFX_MAINFRM_H__C2F3DFCE_230E_49E9_A640_98AC283D471A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CMainFrame : public CExtNCW < CFrameWnd >
{
    
public:
    CMainFrame();
protected:
    DECLARE_DYNAMIC(CMainFrame)

// Attributes
public:

// Operations
public:

// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CMainFrame)
    virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
    virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
    //}}AFX_VIRTUAL

// Implementation
public:
    virtual ~CMainFrame();
#ifdef _DEBUG
    virtual void AssertValid() const;
    virtual void Dump(CDumpContext& dc) const;
#endif
    CExtSplitterWnd                        m_wndSplitterView;
    CExtMenuControlBar                    m_wndMenuBar;
    CExtStatusControlBar                m_wndStatusBar;
    CExtTabPageContainerOneNoteWnd        m_wndTpcAtTop;
    CExtTabPageContainerOneNoteWnd        m_wndTpcAtBottom;
    CExtResizableDialog                    m_dlgAtTop1;
    CExtResizableDialog                    m_dlgAtTop2;
    CExtResizableDialog                    m_dlgAtTop3;
    CExtResizableDialog                    m_dlgAtBottom1;
    CExtResizableDialog                    m_dlgAtBottom2;
    CExtResizableDialog                    m_dlgAtBottom3;

// Generated message map functions
protected:
    //{{AFX_MSG(CMainFrame)
    afx_msg void OnSetFocus(CWnd *pOldWnd);
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
};

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

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

#endif // !defined(AFX_MAINFRM_H__C2F3DFCE_230E_49E9_A640_98AC283D471A__INCLUDED_)

and this is tha mainfrm.cpp

// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "TestProject.h"

#include "MainFrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNAMIC( CMainFrame, CFrameWnd )

BEGIN_MESSAGE_MAP( CMainFrame, CFrameWnd )
    //{{AFX_MSG_MAP(CMainFrame)
    ON_WM_SETFOCUS()
    ON_WM_CREATE()
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
    // TODO: add member initialization code here
    CExtPopupMenuWnd::g_bMenuExpanding = false;
    CExtPopupMenuWnd::g_bMenuHighlightRarely = false;
    VERIFY( g_PaintManager.InstallPaintManager( RUNTIME_CLASS( CExtPaintManagerOffice2007_R1 ) ) );
}

CMainFrame::~CMainFrame()
{
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
    if( ! CExtNCW < CFrameWnd > :: PreCreateWindow( cs ) )
        return FALSE;
    // TODO: Modify the Window class or styles here by modifying
    // the CREATESTRUCT cs

    cs.dwExStyle &= ~(WS_EX_CLIENTEDGE|WS_EX_STATICEDGE);
    cs.style |= WS_CLIPSIBLINGS|WS_CLIPSIBLINGS;
    cs.lpszClass = AfxRegisterWndClass(0);
    return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
    CExtNCW < CFrameWnd > :: AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
    CExtNCW < CFrameWnd > :: Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnSetFocus(CWnd* pOldWnd)
{
    pOldWnd;
    // forward focus to the view window
    if( m_wndSplitterView.GetSafeHwnd() != NULL )
        m_wndSplitterView.SetFocus();
}

BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
    // let the view have first crack at the command
    if(        m_wndSplitterView.GetSafeHwnd() != NULL
        &&    m_wndSplitterView.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo )
        )
        return TRUE;

    // otherwise, do default handling
    return CExtNCW < CFrameWnd > :: OnCmdMsg( nID, nCode, pExtra, pHandlerInfo );
}


int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if( CExtNCW < CFrameWnd > :: OnCreate( lpCreateStruct ) == -1 )
    {
        ASSERT( FALSE );
        return -1;
    }

    if( ! m_wndSplitterView.CreateStatic( this, 2, 1, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, AFX_IDW_PANE_FIRST ) )
    {
        ASSERT( FALSE );
        return -1;
    }
    m_wndSplitterView.SetRowInfo( 0, 300, 30 );
    m_wndSplitterView.SetRowInfo( 1, 300, 30 );

    if( ! m_wndTpcAtTop.Create( &m_wndSplitterView, rectDefault, m_wndSplitterView.IdFromRowCol( 0, 0 ) ) )
    {
        ASSERT( FALSE );
        return -1;
    }
    m_wndTpcAtTop.OrientationSet( __ETWS_ORIENT_TOP );

                if( ! m_dlgAtTop1.Create( IDD_DIALOG1, &m_wndTpcAtTop ) )
                {
                    ASSERT( FALSE );
                    return -1;
                }
                VERIFY( m_wndTpcAtTop.PageInsert( &m_dlgAtTop1, _T("m_dlgAtTop1") ) );

                if( ! m_dlgAtTop2.Create( IDD_DIALOG2, &m_wndTpcAtTop ) )
                {
                    ASSERT( FALSE );
                    return -2;
                }
                VERIFY( m_wndTpcAtTop.PageInsert( &m_dlgAtTop2, _T("m_dlgAtTop2") ) );

                if( ! m_dlgAtTop3.Create( IDD_DIALOG3, &m_wndTpcAtTop ) )
                {
                    ASSERT( FALSE );
                    return -3;
                }
                VERIFY( m_wndTpcAtTop.PageInsert( &m_dlgAtTop3, _T("m_dlgAtTop3") ) );

    if( ! m_wndTpcAtBottom.Create( &m_wndSplitterView, rectDefault, m_wndSplitterView.IdFromRowCol( 1, 0 ) ) )
    {
        ASSERT( FALSE );
        return -1;
    }
    m_wndTpcAtBottom.OrientationSet( __ETWS_ORIENT_BOTTOM );

                if( ! m_dlgAtBottom1.Create( IDD_DIALOG1, &m_wndTpcAtBottom ) )
                {
                    ASSERT( FALSE );
                    return -1;
                }
                VERIFY( m_wndTpcAtBottom.PageInsert( &m_dlgAtBottom1, _T("m_dlgAtBottom1") ) );

                if( ! m_dlgAtBottom2.Create( IDD_DIALOG2, &m_wndTpcAtBottom ) )
                {
                    ASSERT( FALSE );
                    return -2;
                }
                VERIFY( m_wndTpcAtBottom.PageInsert( &m_dlgAtBottom2, _T("m_dlgAtBottom2") ) );

                if( ! m_dlgAtBottom3.Create( IDD_DIALOG3, &m_wndTpcAtBottom ) )
                {
                    ASSERT( FALSE );
                    return -3;
                }
                VERIFY( m_wndTpcAtBottom.PageInsert( &m_dlgAtBottom3, _T("m_dlgAtBottom3") ) );

    m_wndMenuBar.m_bAppearInDockSiteControlBarPopupMenu = false;
    if( ! m_wndMenuBar.Create( NULL, this ) )
    {
        ASSERT( FALSE );
        return -1;
    }

    if( ! m_wndStatusBar.Create( this ) )
    {
        ASSERT( FALSE );
        return -1;
    }

    return 0;
}