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 Tech Support » DockControlBarLTRB Collapse All
Subject Author Date
Ian McIntosh Jan 30, 2007 - 4:11 AM

Hi,

I am wanting to get a CExtControlBar to dock at the bottom of another at startup. I use:
m_wndSelectionList.DockControlBarLTRB(    &m_wndSystemTree, AFX_IDW_DOCKBAR_BOTTOM);

which seems to give me the positioning I am looking for but the contents of the bottom CExtControlBar does not get drawn (is just black).
If I auto hide then redock it, it displays OK.

Ian McIntosh Feb 15, 2007 - 4:08 AM

Thanks, thats done the trick.

Ian McIntosh Feb 14, 2007 - 2:32 AM

I have now had confirmation that you have received the sample project and document with screenshots. Please can you now confirm if you are able to reproduce the problem & which version of Prof-UIS / VS you have used. Thanks.

Technical Support Jan 30, 2007 - 12:03 PM

Could you show the code that initializes all the control bars in your main frame window. Typically it is in the CMainFrame::OnCreate() method?

Ian McIntosh Jan 31, 2007 - 2:37 AM

It is System Tree & Selection list (underlined with a row of = below) that I am having a problem with.
I would like them both docked to the left hand side, system tree at the top, selection list at the bottom.

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
CWinApp * pApp = ::AfxGetApp();
    ASSERT( pApp != NULL );
    ASSERT( pApp->m_pszRegistryKey != NULL );
    ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
    ASSERT( pApp->m_pszProfileName != NULL );
    ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
    pApp;



    if (CExtNCW < CMDIFrameWnd >::OnCreate(lpCreateStruct) == -1)
        return -1;


    VERIFY(
        g_CmdManager->ProfileWndAdd(
            __PROF_UIS_PROJECT_CMD_PROFILE_NAME,
            GetSafeHwnd()
            )
        );
    VERIFY(
        g_CmdManager->UpdateFromMenu(
            __PROF_UIS_PROJECT_CMD_PROFILE_NAME,
            IDR_MAINFRAME
            )
        );
    VERIFY(
        g_CmdManager->UpdateFromMenu(
            __PROF_UIS_PROJECT_CMD_PROFILE_NAME,
            IDR_MAINFRAME
            )
        );
    VERIFY(
        g_CmdManager->UpdateFromMenu(
            __PROF_UIS_PROJECT_CMD_PROFILE_NAME,
            IDR_GuiMdiTYPE
            )
            //IDR_$$DOC$$TYPE
        );
    
//PROJTYPE_MDI
    if(    ! m_wndRibbonBar.Create(NULL,    this ))
    {
        TRACE0("Failed to create the m_wndRibbonBar toolbar\n");
        return -1; // fail to create
    }
m_wndRibbonBar.Init();
    
    if(    !m_wndToolBar.Create(
            NULL, // _T("Main Toolbar"),
            this,
            AFX_IDW_TOOLBAR,
            WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC
                | CBRS_TOOLTIPS
                    | CBRS_HIDE_INPLACE
            ) ||
        !m_wndToolBar.LoadToolBar( IDR_MAINFRAME )
        )
    {
        TRACE0("Failed to create toolbar\n");
        return -1; // fail to create
    }

    if (!m_wndStatusBar.Create(this) ||
        !m_wndStatusBar.SetIndicators(indicators,
         sizeof(indicators)/sizeof(UINT)))
    {
        TRACE0("Failed to create status bar\n");
        return -1; // fail to create
    }



    // TODO: Delete these lines if you don’t want the dockable entity
    m_wndToolBar.EnableDocking( CBRS_ALIGN_ANY );

    // Enable control bars in the frame window to be redocable
//VERBOSE
    if( !CExtControlBar::FrameEnableDocking(this) )
    {
        ASSERT( FALSE );
        return -1;
    }

    // Enable autohide feature for resizable control bars
//VERBOSE
    if( !CExtControlBar::FrameInjectAutoHideAreas(this) )
    {
        ASSERT( FALSE );
        return -1;
    }

    DockControlBar( &m_wndToolBar );

    if( !m_wndMdiManager.Create(
            this,
            CRect( 0, 0, 0, 0 ),
            UINT( IDC_STATIC ),
            WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
            __ETWS_ORIENT_TOP
            |__ETWS_ENABLED_BTN_CLOSE
            |__ETWS_SHOW_BTN_CLOSE
            )
            //PUIS_TABWINDOWFROMDI - $$__PROFUISAPPWIZ_KEY_ADF_MDITABS$$
        )
    {
        ASSERT( FALSE );
        return -1;
    }

// Init System tree:
// ===========
    m_wndSystemTree.SetInitDesiredSizeVertical( CSize( 200, 400 ));
    m_wndSystemTree.SetInitDesiredSizeHorizontal( CSize( 400, 200 ));
    if(    !m_wndSystemTree.Create(
            "System Tree", // NULL, // _T("Optional control bar caption"),
            this,
            ID_SYSTEM_TREE,
            WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER
                |CBRS_TOOLTIPS
                |CBRS_FLYBY
                |CBRS_SIZE_DYNAMIC
                |CBRS_HIDE_INPLACE
            )
        )
    {
        TRACE0("Failed to create m_wndSystemTree\n");
        return -1;        // fail to create
    }
    if( !m_wndSystemTreeCtrl.Create(
            WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_HSCROLL
             |TVS_HASBUTTONS|TVS_HASLINES|TVS_LINESATROOT
             |TVS_INFOTIP
             |TVS_SINGLEEXPAND|TVS_SHOWSELALWAYS,
            CRect(0,0,0,0),
            &m_wndSystemTree,
            m_wndSystemTree.GetDlgCtrlID()
            )
        )
    {
        TRACE0("Failed to create m_wndSystemTreeCtrl\n");
        return -1;        // fail to create
    }
    m_wndSystemTree.SetFont(
        CFont::FromHandle((HFONT)::GetStockObject(DEFAULT_GUI_FONT)    ));
    m_wndSystemTree.EnableDocking( CBRS_ALIGN_ANY );
    m_wndSystemTree.DockControlBar( AFX_IDW_DOCKBAR_LEFT,    1, this    );

// Init Resource tree:
    m_wndResourceTree.SetInitDesiredSizeVertical( CSize( 200, 400 ));
    m_wndResourceTree.SetInitDesiredSizeHorizontal( CSize( 400, 200 ));
    if(    !m_wndResourceTree.Create(
            "Resource Tree", // NULL, // _T("Optional control bar caption"),
            this,
            ID_RESOURCE_TREE,
            WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER
                |CBRS_TOOLTIPS
                |CBRS_FLYBY
                |CBRS_SIZE_DYNAMIC
                |CBRS_HIDE_INPLACE
            )
        )
    {
        TRACE0("Failed to create m_wndResourceTree\n");
        return -1;        // fail to create
    }
    if( !m_wndResourceTreeCtrl.Create(
            WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_HSCROLL
             |TVS_HASBUTTONS|TVS_HASLINES|TVS_LINESATROOT
             |TVS_INFOTIP|TVS_DISABLEDRAGDROP
             |TVS_SINGLEEXPAND|TVS_SHOWSELALWAYS,
            CRect(0,0,0,0),
            &m_wndResourceTree,
            m_wndResourceTree.GetDlgCtrlID()
            )
        )
    {
        TRACE0("Failed to create m_wndResourceTreeCtrl\n");
        return -1;        // fail to create
    }
    m_wndResourceTree.SetFont(
        CFont::FromHandle((HFONT)::GetStockObject(DEFAULT_GUI_FONT)    ));
    m_wndResourceTree.EnableDocking( CBRS_ALIGN_ANY );
    m_wndResourceTree.DockControlBar( AFX_IDW_DOCKBAR_LEFT,    1, this    );
m_wndResourceTree.AutoHideModeSet(true, true, true, false);

// Init Selection List:
// ============
    m_wndSelectionList.SetInitDesiredSizeVertical( CSize( 100, 200 ));
//    m_wndSelectionList.SetInitDesiredSizeHorizontal( CSize( 400, 200 ));
    if(    !m_wndSelectionList.Create(
            "Selection List", // NULL, // _T("Optional control bar caption"),
            this,
            ID_SELECTION_LIST,
            WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_GRIPPER
                |CBRS_TOOLTIPS
                |CBRS_FLYBY
                |CBRS_SIZE_DYNAMIC
                |CBRS_HIDE_INPLACE
            )
        )
    {
        TRACE0("Failed to create m_wndSelectionList\n");
        return -1;        // fail to create
    }
    if( !m_wndSelectionListCtrl.Create(
LVS_LIST,
            CRect(0,0,0,0),
            &m_wndSelectionList,
            m_wndSelectionList.GetDlgCtrlID()
            )
        )
    {
        TRACE0("Failed to create m_wndSelectionListCtrl\n");
        return -1;        // fail to create
    }
    m_wndSelectionList.SetFont(
        CFont::FromHandle((HFONT)::GetStockObject(DEFAULT_GUI_FONT)    ));
    m_wndSelectionList.EnableDocking( CBRS_ALIGN_ANY );
//    m_wndSelectionList.DockControlBar( AFX_IDW_DOCKBAR_LEFT,    1, this    );
    m_wndSelectionList.DockControlBarLTRB(
        &m_wndSystemTree, AFX_IDW_DOCKBAR_BOTTOM);
// m_wndSelectionList.AutoHideModeSet(true, true, true, false);
/*
    CExtControlBar::ProfileBarStateLoad(
        this,
        pApp->m_pszRegistryKey,
        pApp->m_pszProfileName,
        pApp->m_pszProfileName,
        &m_dataFrameWP
        );

    g_CmdManager->SerializeState(
        __PROF_UIS_PROJECT_CMD_PROFILE_NAME,
        pApp->m_pszRegistryKey,
        pApp->m_pszProfileName,
        false
        );
*/
return 0;
}

Technical Support Feb 1, 2007 - 3:16 AM

Here is a new version of your CMainFrame::OnCreate() method with the fixed initialization sequence:

int CMainFrame::OnCreate( LPCREATESTRUCT lpCreateStruct )
{
    if( CExtNCW < CMDIFrameWnd > :: OnCreate( lpCreateStruct ) == -1 )
        return -1;
 
    /////////////////////////////////////////////////////////
    // STEP 1: Initialize the command manager
    /////////////////////////////////////////////////////////
 
CWinApp * pApp = ::AfxGetApp();
    ASSERT( pApp != NULL );
    ASSERT( pApp->m_pszRegistryKey != NULL );
    ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
    ASSERT( pApp->m_pszProfileName != NULL );
    ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
 
    VERIFY(
        g_CmdManager->ProfileWndAdd(
            __PROF_UIS_PROJECT_CMD_PROFILE_NAME,
            GetSafeHwnd()
            )
        );
    VERIFY(
        g_CmdManager->UpdateFromMenu(
            __PROF_UIS_PROJECT_CMD_PROFILE_NAME,
            IDR_MAINFRAME
            )
        );
    VERIFY(
        g_CmdManager->UpdateFromMenu(
            __PROF_UIS_PROJECT_CMD_PROFILE_NAME,
            IDR_MAINFRAME
            )
        );
    VERIFY(
        g_CmdManager->UpdateFromMenu(
            __PROF_UIS_PROJECT_CMD_PROFILE_NAME,
            IDR_GuiMdiTYPE
            )
        );
    
    /////////////////////////////////////////////////////////
    // STEP 2: Pre-initialize fixed size bars
    //         (menu bar, ribbon bar, toolbars)
    /////////////////////////////////////////////////////////
 
    if( ! m_wndRibbonBar.Create( NULL, this ) )
    {
        TRACE0("Failed to create the m_wndRibbonBar toolbar\n");
        ASSERT( FALSE );
        return -1; // fail to create
    }
    m_wndRibbonBar.Init();
    
    if(     (! m_wndToolBar.Create( NULL, this, AFX_IDW_TOOLBAR ) )
        ||  (! m_wndToolBar.LoadToolBar( IDR_MAINFRAME ) )
        )
    {
        TRACE0("Failed to create toolbar\n");
        ASSERT( FALSE );
        return -1; // fail to create
    }
 
    /////////////////////////////////////////////////////////
    // STEP 3: Pre-initialize resizable bars
    /////////////////////////////////////////////////////////
HFONT hDefaultGuiFont = (HFONT) ::GetStockObject( DEFAULT_GUI_FONT );
    if( hDefaultGuiFont == NULL )
    {
        hDefaultGuiFont = (HFONT) ::GetStockObject( SYSTEM_FONT );
        ASSERT( hDefaultGuiFont != NULL );
    }
 
    // Init System tree (part 1):
    m_wndSystemTree.SetInitDesiredSizeVertical( CSize( 200, 400 ) );
    m_wndSystemTree.SetInitDesiredSizeHorizontal( CSize( 400, 200 ) );
    if( ! m_wndSystemTree.Create( _T("System Tree"), this, ID_SYSTEM_TREE ) )
    {
        TRACE0("Failed to create m_wndSystemTree\n");
        ASSERT( FALSE );
        return -1; // fail to create
    }
    if( ! m_wndSystemTreeCtrl.Create(
            WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_HSCROLL
                |TVS_HASBUTTONS|TVS_HASLINES|TVS_LINESATROOT
                |TVS_INFOTIP|TVS_SINGLEEXPAND|TVS_SHOWSELALWAYS,
            CRect( 0, 0, 0, 0 ),
            &m_wndSystemTree,
            m_wndSystemTree.GetDlgCtrlID() 
            )
        )
    {
        TRACE0("Failed to create m_wndSystemTreeCtrl\n");
        ASSERT( FALSE );
        return -1; // fail to create
    }
    m_wndSystemTree.SetFont( CFont::FromHandle( hDefaultGuiFont ) );
 
    // Init Resource tree (part 1):
    m_wndResourceTree.SetInitDesiredSizeVertical( CSize( 200, 400 ) );
    m_wndResourceTree.SetInitDesiredSizeHorizontal( CSize( 400, 200 ) );
    if( ! m_wndResourceTree.Create( _T("Resource Tree"), this, ID_RESOURCE_TREE ) )
    {
        TRACE0("Failed to create m_wndResourceTree\n");
        ASSERT( FALSE );
        return -1;  // fail to create
    }
    if( ! m_wndResourceTreeCtrl.Create(
            WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_HSCROLL
                |TVS_HASBUTTONS|TVS_HASLINES|TVS_LINESATROOT
                |TVS_INFOTIP|TVS_DISABLEDRAGDROP
                |TVS_SINGLEEXPAND|TVS_SHOWSELALWAYS,
            CRect( 0, 0, 0, 0 ),
            &m_wndResourceTree,
            m_wndResourceTree.GetDlgCtrlID() 
            )
        )
    {
        TRACE0("Failed to create m_wndResourceTreeCtrl\n");
        ASSERT( FALSE );
        return -1; // fail to create
    }
    m_wndResourceTree.SetFont( CFont::FromHandle( hDefaultGuiFont ) );
 
    // Init Selection List (part 1):
    m_wndSelectionList.SetInitDesiredSizeVertical( CSize( 100, 200 ) );
    if( ! m_wndSelectionList.Create( _T("Selection List"), this, ID_SELECTION_LIST ) )
    {
        TRACE0("Failed to create m_wndSelectionList\n");
        ASSERT( FALSE );
        return -1; // fail to create
    }
    if( ! m_wndSelectionListCtrl.Create(
            LVS_LIST,
            CRect( 0, 0, 0, 0 ),
            &m_wndSelectionList,
            m_wndSelectionList.GetDlgCtrlID() 
            )
        )
    {
        TRACE0("Failed to create m_wndSelectionListCtrl\n");
        ASSERT( FALSE );
        return -1; // fail to create
    }
    m_wndSelectionList.SetFont( CFont::FromHandle( hDefaultGuiFont ) );
 
    /////////////////////////////////////////////////////////
    // STEP 4: Initialize status bar
    /////////////////////////////////////////////////////////
 
    if(     (! m_wndStatusBar.Create( this ) )
        ||  (! m_wndStatusBar.SetIndicators( indicators, sizeof(indicators)/sizeof(UINT) ) ) )
    {
        TRACE0("Failed to create status bar\n");
        ASSERT( FALSE );
        return -1; // fail to create
    }
 
    /////////////////////////////////////////////////////////
    // STEP 5: Enable re-docking feature only for those
    //         bars which need it
    /////////////////////////////////////////////////////////
 
    m_wndToolBar.EnableDocking( CBRS_ALIGN_ANY );
 
    // Init System tree (part 2):
    m_wndSystemTree.EnableDocking( CBRS_ALIGN_ANY );
 
    // Init Resource tree (part 2):
    m_wndResourceTree.EnableDocking( CBRS_ALIGN_ANY );
 
    // Init Selection List (part 2):
    m_wndSelectionList.EnableDocking( CBRS_ALIGN_ANY );
 
    /////////////////////////////////////////////////////////
    // STEP 6: Enable re-docking feature only for entire
    //         main frame window and, optionally, enable
    //         enable auto-hiding feature fore resizable
    //         bars
    /////////////////////////////////////////////////////////
 
    // Enable control bars in the frame window to be redocable
    if( ! CExtControlBar::FrameEnableDocking( this ) )
    {
        ASSERT( FALSE );
        return -1;
    }
 
    // Enable autohide feature for resizable control bars
    if( ! CExtControlBar::FrameInjectAutoHideAreas( this ) )
    {
        ASSERT( FALSE );
        return -1;
    }
 
    /////////////////////////////////////////////////////////
    // STEP 7: Load command manager state if needed
    /////////////////////////////////////////////////////////
 
//  g_CmdManager->SerializeState(
//      __PROF_UIS_PROJECT_CMD_PROFILE_NAME,
//      pApp->m_pszRegistryKey,
//      pApp->m_pszProfileName,
//      false
//      );
 
    /////////////////////////////////////////////////////////
    // STEP 8: Try to load state of all the bars and dock
    //         all of them initially if the state loading
    //         was failed
    /////////////////////////////////////////////////////////
 
    if( ! CExtControlBar::ProfileBarStateLoad(
            this,
            pApp->m_pszRegistryKey,
            pApp->m_pszProfileName,
            pApp->m_pszProfileName,
            &m_dataFrameWP
            )
        )
    {
        DockControlBar( &m_wndToolBar );
 
        // Init System tree (part 3):
        m_wndSystemTree.DockControlBarInnerOuter( AFX_IDW_DOCKBAR_LEFT, true );
 

        // Init Resource tree (part 3):
        m_wndResourceTree.DockControlBarLTRB( &m_wndSystemTree, AFX_IDW_DOCKBAR_BOTTOM );
 
        // Init Selection List (part 3):
        m_wndSelectionList.DockControlBarInnerOuter( AFX_IDW_DOCKBAR_LEFT, true );
 
    }
 
    /////////////////////////////////////////////////////////
    // STEP 9: Initialize other features. Embeddable controls
    //         such as MDI tabs should be initialized here
    /////////////////////////////////////////////////////////
 
    if( ! m_wndMdiManager.Create(
            this, 
            CRect( 0, 0, 0, 0 ),
            UINT( IDC_STATIC ),
            WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
                __ETWS_ORIENT_TOP|__ETWS_ENABLED_BTN_CLOSE|__ETWS_SHOW_BTN_CLOSE
            )
        )
    {
        ASSERT( FALSE );
        return -1;
    }
 
    return 0;
}



Ian McIntosh Feb 1, 2007 - 6:06 AM

I have tried this and still get the same problem. I have emailed you screenshots.

Technical Support Feb 1, 2007 - 11:18 AM

Please try RecalcLayout(); at the end of the CMainFrame::OnCreate() method. If it does not help, would you send us a project that reproduces the problem?

Ian McIntosh Feb 2, 2007 - 4:04 AM

RecalcLayout() has made no difference.
I have sent an email with a sample project and screen shots attached

Technical Support Feb 2, 2007 - 11:26 AM

We are sorry by we have not yet received that email with your sample project. Would you send it again? We have an account at gmail (profuis at gmail.com) so you can also use it.

Ian McIntosh Feb 12, 2007 - 3:09 AM

I have replied to your latest email with sample project and screenshots showing problem. Could you please confirm if you can reproduce the problem.

Technical Support Feb 12, 2007 - 2:37 PM

No, we have not received it yet. Please try sending it to profuis at gmail.com



Ian McIntosh Feb 13, 2007 - 3:33 AM

I replied to your e-mail and copied it to profuis@gmail.com . You should have it now. NB, I am using Prof-UIS 2.63 in VS 2005.
Please let me know if you can reproduce the problem, & if not confirm if you are using Prof-UIS 2.63 in VS 2005.

Technical Support Feb 13, 2007 - 4:04 AM

Not received it again. It seems it is filtered out somewhere. Would you send us a test email?

Ian McIntosh Feb 13, 2007 - 4:24 AM

sent a reply to your email and forwarded it to the other address, did you get it?

Ian McIntosh Feb 13, 2007 - 7:17 AM

I have replied to your last email with an ftp address from which I am told you should be able to download the files. Please let me know if you are able to access it ok.

Technical Support Feb 14, 2007 - 11:20 AM

Thank you for the test project. The problem was caused by that you had not specified the WS_CHILD and WS_VISIBLE styles when creating the child list box:

if( !m_wndSelectionListCtrl.Create(
        WS_CHILD|WS_VISIBLE|LVS_LIST,
        CRect(0,0,0,0),
        &m_wndSelectionList,
        m_wndSelectionList.GetDlgCtrlID() 
        )
    )
{
    TRACE0("Failed to create m_wndSelectionListCtrl\n");
    return -1;        // fail to create
}