Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Migration problem..toolbar layout bad!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Migration problem..toolbar layout bad!

 Post Reply Post Reply
Author
Message
Joyce View Drop Down
Newbie
Newbie


Joined: 30 June 2005
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Joyce Quote  Post ReplyReply Direct Link To This Post Topic: Migration problem..toolbar layout bad!
    Posted: 30 June 2005 at 11:38pm

Hi,

I am migrating my MDI application with toolbar and docking windows to Xtreme toolkit.

I replaced the CToolbar class with CXTToolbar as follow the guidance of ToolkitProManual.

I planed to change toolbar immediately and to defer changing the docking windows later for some reasons.

Docking window uses a CSizingControlBar(from codeguru) -derived class.

But, unfortunately, I can't layout toolbar and docking bars pretty.

I want to put docking window below the toolbar..

Can I do this job without replacing the docking window to the one in Xtreme toolkit ?

Below is my test program's CMainFrame::OnCreate()

=============================================

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

// --- status bar creation
 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
 }


 EnableDocking(CBRS_ALIGN_ANY);

// --- instant bar --- Docking window not derived from xtreme toolkit
 if (!m_wndInstantBar.Create(_T("Instant Bar"), this, 127))
 {
  TRACE0("Failed to create instant bar\n");
  return -1;  // fail to create
 }
 m_wndInstantBar.SetSCBStyle(m_wndInstantBar.GetSCBStyl e() |
  SCBS_SIZECHILD);
 if (!m_wndIBTree.Create(WS_CHILD|WS_VISIBLE|
  TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT,
  CRect(0, 0, 0, 0), &m_wndInstantBar, 100))
 {
  TRACE0("Failed to create instant bar child\n");
  return -1;  // fail to create
 }
 m_wndIBTree.ModifyStyleEx(0, WS_EX_CLIENTEDGE);
 
 // bring the tooltips to front
 CWnd* pTT = FromHandle((HWND) m_wndIBTree.SendMessage(TVM_GETTOOLTIPS));
    if (pTT != NULL)
  pTT->SetWindowPos(&wndTopMost, 0, 0, 0, 0,
  SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
 
 // populate the treectrl
 HTREEITEM hti = m_wndIBTree.InsertItem(_T("Node 1"));
 m_wndIBTree.InsertItem(_T("Node 2"));
 m_wndIBTree.InsertItem(_T("SubNode 11"), hti);
 m_wndIBTree.InsertItem(_T("SubNode 12"), hti);
 // --- end instant bar creation and child setup ---
 
 m_wndInstantBar.SetBarStyle(m_wndInstantBar.GetBarStyl e() |
  CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

 m_wndInstantBar.EnableDocking(CBRS_ALIGN_LEFT|CBRS_ALI GN_RIGHT);

 
#ifdef _SCB_REPLACE_MINIFRAME
    m_pFloatingFrameClass = RUNTIME_CLASS(CSCBMiniDockFrameWnd);
#endif //_SCB_REPLACE_MINIFRAME

 // dock mybar2 on the same row with mybar1
 RecalcLayout();
 CRect rBar;
 DockControlBar(&m_wndInstantBar, AFX_IDW_DOCKBAR_LEFT);
 
 CString sProfile = _T("BarState");
 if (VerifyBarState(sProfile))
 {
  CSizingControlBar::GlobalLoadState(this, sProfile);
  LoadBarState(sProfile);
 }

// --- instant bar --- creation end
//////////////////////////////////////////////////////////// //////
// xtreme toolkit command bar creation start
// Initialize the command bars
    if (!InitCommandBars())
        return -1;

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

    // Add the menu bar
    CXTPToolBar* pMenuBar = pCommandBars->SetMenu(
        _T("Menu Bar"), IDR_MAINFRAME);      
    if(pMenuBar == NULL)
    {
        TRACE0("Failed to create menu bar.\n");
        return -1;      // fail to create
    }

    // Create ToolBar
    CXTPToolBar* pToolBar = (CXTPToolBar*)
        pCommandBars->Add(_T("Standard"), xtpBarTop);
    if (!pToolBar || !pToolBar->LoadToolBar(IDR_MAINFRAME))
    {
        TRACE0("Failed to create toolbar\n");
        return -1;
    }

    pMenuBar->SetFlags(xtpFlagAddMDISysPopup);
    // Set Office 2003 Theme
    CXTPPaintManager::SetTheme(xtpThemeOffice2003);

 return 0;
}

Please let me know the best way to layout  normally.

Thanks in advance,

Joyce

 

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 03 July 2005 at 11:30pm

move "xtreme toolkit command bar creation start" block before

EnableDocking(CBRS_ALIGN_ANY);

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Joyce View Drop Down
Newbie
Newbie


Joined: 30 June 2005
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Joyce Quote  Post ReplyReply Direct Link To This Post Posted: 04 July 2005 at 1:33am

 

It works!  

Thank you and have a nice day!

 

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.