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 to create flexible panles? Collapse All
Subject Author Date
farhan khan Aug 14, 2006 - 3:53 AM

Hi,
i am new user of prof uis, after check several samples i have created 3 Panels , Top panel,Left panel and center panel and created three Dialog’s with their respective classes. After their creation i seen that if i maximize the framwwindow then all my panels becomes upside down and changes their actual positions that i have set...even they became smaller and larger...and shows white portion in between them... How can i set this look according to any any resolution or maximization.

thanks in advance

Technical Support Aug 14, 2006 - 7:46 AM

We need more info about your project. We guess the panels in your question are control bars (CExtControlBar), but we are not completely sure. If our guess is correct, we need to take a look at the CMainFrame::OnCreate() method to check the initialization sequence for the bars.

farhan khan Aug 15, 2006 - 11:08 AM

i have created few classes according to dialogs and declare their variables on the mainframe header with their panels
like below
CTopDialog m_TopDlg;
    CLeftDialog m_LeftDlg;
    CCenterDialog m_CenterDlg;
    CSettingDialog m_SettingDlg;

    CExtPanelControlBar m_TopPanel;
    CExtPanelControlBar m_LeftPanel;
    CExtPanelControlBar m_CenterPanel;
    CExtPanelControlBar m_SettingPanel;


and then i have initialize them inside the
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
        return -1;

        // create a view to occupy the client area of the frame
/*    if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
        CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
    {
        TRACE0("Failed to create view window\n");
        return -1;
    }
*/    


    CreateToolBarAndMenuBar();
    CreateTopDialog();
    CreateLeftDialog();
    CreateCenterDialog();
    CreateSettingDlg();

    

    return 0;
}



int CMainFrame::CreateLeftDialog()
{

        if(!m_LeftPanel.Create(
                _T("Empty Panel"),
                this,
                NULL,
                WS_CHILD|WS_VISIBLE
                |CBRS_LEFT|CBRS_GRIPPER|CBRS_TOOLTIPS
                |CBRS_FLYBY|CBRS_SIZE_DYNAMIC
                    
                )
        )
    {
        TRACE0("Failed to create bars/panels\n");
        return -1; // fail to create
    }

        
    if(    !m_LeftDlg.Create(
                            IDD_DIALOG_LEFT,
                            &m_LeftPanel
                        )                
        )
    {
        TRACE0("Failed to create bars/panels\n");
        return -1; // fail to create


    }

        ShowControlBar( &m_LeftPanel, TRUE, TRUE );
    m_LeftPanel.EnableDocking(CBRS_ALIGN_ANY);
    m_LeftDlg.ShowSizeGrip( TRUE );

return 1;
}

int CMainFrame::CreateTopDialog()
{

    if(!m_TopPanel.Create(
                _T("Empty Panel"),
                this,
                NULL,
                WS_CHILD|WS_VISIBLE
                |CBRS_TOP|CBRS_GRIPPER|CBRS_TOOLTIPS
                |CBRS_FLYBY|CBRS_SIZE_DYNAMIC
                    
                )
        )
    {
        TRACE0("Failed to create bars/panels\n");
        return -1; // fail to create
    }

        
    if(    !m_TopDlg.Create(
                            IDD_DIALOG_TOP,
                            &m_TopPanel
                        )                
        )
    {
        TRACE0("Failed to create bars/panels\n");
        return -1; // fail to create


    }

        ShowControlBar( &m_TopPanel, TRUE, TRUE );
    m_TopPanel.EnableDocking(CBRS_ALIGN_ANY);
    m_TopDlg.ShowSizeGrip( TRUE );

    return 1;
}

int CMainFrame::CreateToolBarAndMenuBar()
{
    if(!m_wndMenuBar.Create(
NULL, // _T("Menu Bar"),
this,
IDR_MAINFRAME
))
    {
        TRACE0("Failed to create menubar\n");
        return -1;
    }

    if( !m_wndToolBar.Create(
_T( "Toolbar name" ),
this,
AFX_IDW_TOOLBAR
)
|| !m_wndToolBar.LoadToolBar( IDR_MAINFRAME )
)
    {
        TRACE0( "Failed to create toolbar" );
        return -1;
    }


    
    m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
    EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_wndToolBar);

    if( !CExtControlBar::FrameEnableDocking(this) )
    {
        ASSERT( FALSE );
        return -1;
    }

return 1;
}

int CMainFrame::CreateCenterDialog()
{

        if(!m_CenterPanel.Create(
                _T("Empty Panel"),
                this,
                NULL,
                WS_CHILD|WS_VISIBLE
                |CBRS_RIGHT|CBRS_GRIPPER|CBRS_TOOLTIPS
                |CBRS_FLYBY|CBRS_SIZE_DYNAMIC
                    
                )
        )
    {
        TRACE0("Failed to create bars/panels\n");
        return -1; // fail to create
    }

        
    if(    !m_CenterDlg.Create(
                            IDD_DIALOG_CENTER,
                            &m_CenterPanel
                        )                
        )
    {
        TRACE0("Failed to create bars/panels\n");
        return -1; // fail to create


    }

        ShowControlBar( &m_CenterPanel, TRUE, TRUE );
    m_CenterPanel.EnableDocking(CBRS_ALIGN_ANY);
    m_CenterDlg.ShowSizeGrip( TRUE );

return 1;
}

int CMainFrame::CreateSettingDlg()
{
    

            if(!m_SettingPanel.Create(
                _T("Empty Panel"),
                this,
                NULL,
                WS_CHILD|WS_VISIBLE
                |CBRS_RIGHT|CBRS_GRIPPER|CBRS_TOOLTIPS
                |CBRS_FLYBY|CBRS_SIZE_DYNAMIC
                    
                )
        )
    {
        TRACE0("Failed to create bars/panels\n");
        return -1; // fail to create
    }

        
    if(    !m_SettingDlg.Create(
                            IDD_DIALOG_SETTINGS,
                            &m_SettingPanel
                        )                
        )
    {
        TRACE0("Failed to create bars/panels\n");
        return -1; // fail to create


    }

    ShowControlBar( &m_SettingPanel, FALSE, TRUE );
    m_SettingPanel.EnableDocking(CBRS_ALIGN_ANY);
    m_SettingDlg.ShowSizeGrip( TRUE );

    return 1;
}

this is all what i am doing in mainframe.


thanks in advance

Technical Support Aug 16, 2006 - 10:31 AM

The control bar related features of the MFC’s CFrameWnd window were not initialized correctly in your CMainFrame::OnCreate() method. Please put the following code immediately before invoking CreateToolBarAndMenuBar():

    if( ! CExtControlBar::FrameEnableDocking( this ) )
    {
        ASSERT( FALSE );
        return -1;
    }
Besides, you commented the view window’s creation code. This is not correct usage of the MFC’s CFrameWnd class. The frame window must have one child window in the middle area that is free of control bars docked to the borders. This middle window is the view window in SDI applications and the MDI client area in MDI applications.

farhan khan Aug 17, 2006 - 3:45 PM

thanks alot for your help, ill follow your instruction and will tell you the result...
regards