Guides & Tutorials (beta)

Upgrading Toolkit Standard to Toolkit Pro - Command Bar Initialization

by Kirk Stowell Visual C++ Created on 11/16/2007  |  Updated on 07/31/2024 0/5 ( 0 votes )

Command Bar must be initialized prior to using them and, they must be created after all control bar objects (such as your status bar) have been created.  This is also a good place for you to set the theme for the Command Bar.  In the standard version you would call xtAfxData.bXPMode = true; to set the theme for the toolkit to Officexp.  In the professional version you have theme managers for each component.  This allows you to define your own theme or select from several pre defined themes in the toolkit.

The following is an example of how to initialize the control bars:

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
        return -1;

    // Create Status bar. 
    // Important: All control bars including the Status Bar 
    // must be created before CommandBars....
    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
    }

    // Initialize the Command Bar
    if (!InitCommandBars())
        return -1;

    // Get a pointer to the Command Bar object.
    CXTPCommandBars* pCommandBars = GetCommandBars();
    if(pCommandBars == NULL)
    {
        TRACE0("Failed to create Command Bar object.\n");
        return -1;      // fail to create
    }

    // Set Office 2003 Theme
    CXTPPaintManager::SetTheme(xtpThemeOfficeXP);</font>

    return 0;
}

Cool Menu Note:

It is no longer necessary to call InstallCoolMenus to initialize themed menus with command icons for your application.  This is done internally with the Command Bar theme manager.

User Comments

No comments yet, sign in to comment.

Secure Transactions

Online transactions are secure and protected.


Ssl seal 1
This site is protected by Trustwave's Trusted Commerce program
CompliAssure Secured

Money Back Guarantee

If you are not 100% happy with your purchase within 30 days, you can return it for any reason. Your satisfaction is our priority!


Satisfication Guaranteed

Contact sales@codejock.com for more details.