Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Dock CXTPToolBar at bottom of CMDIChildWn
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Dock CXTPToolBar at bottom of CMDIChildWn

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


Joined: 28 February 2004
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote CamG Quote  Post ReplyReply Direct Link To This Post Topic: Dock CXTPToolBar at bottom of CMDIChildWn
    Posted: 28 February 2004 at 9:09pm

Scenario: MDI application, want to dock toolbar at bottom of child window. CChildFrame is derived from CMDIChildWnd, and m_wndToolBar is a CXTPToolBar.

Code below results in toolbar docked at top - anyone with any ideas as to why? I even threw in a call to RepositionBars() for good measure.

 

int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{

if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
    return
-1;

EnableDocking(CBRS_ALIGN_BOTTOM);

m_wndToolBar.SetFlags(xtpFlagStretched | xtpFlagAlignBottom);

VERIFY(m_wndToolBar.CreateToolBar(WS_CHILD|CBRS_TOOLTIPS|CBR S_ALIGN_BOTTOM|CBRS_BOTTOM, this, AFX_IDW_TOOLBAR));

VERIFY(m_wndToolBar.LoadToolBar(IDR_MAINFRAME, TRUE));

m_wndToolBar.SetPosition(xtpBarBottom);
m_wndToolBar.SetVisible(TRUE);

RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

return 0;

}



Edited by CamG
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 28 February 2004 at 11:16pm
Are you looking to have one toolbar that is docked at the bottom of the main MDI form that will be under the child window?  Or do you want a separate toolbar for each child window that is docked to the bottom of each window?
Back to Top
CamG View Drop Down
Newbie
Newbie


Joined: 28 February 2004
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote CamG Quote  Post ReplyReply Direct Link To This Post Posted: 28 February 2004 at 11:36pm

One separate toolbar per child window, docked and fixed (no grab handle, customisation, etc.).

I have several doc views, and the view loaded into the child window will set the toolbar's configuration (i.e. selects which toolbar resource is loaded).

Back to Top
CamG View Drop Down
Newbie
Newbie


Joined: 28 February 2004
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote CamG Quote  Post ReplyReply Direct Link To This Post Posted: 29 February 2004 at 2:57am

Came up with another approach which gives better results, but not quite right yet...

int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
 if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
           return -1;

 CXTPCommandBars* pCommandBars = CXTPCommandBars::CreateCommandBars();

 pCommandBars->GetCommandBarsOptions()->bSyncFloa tingBars = TRUE;
 pCommandBars->GetCommandBarsOptions()->bDblClick Float = FALSE;
 pCommandBars->SetSite(this);
 pCommandBars->EnableDocking();

     // Create ToolBar
 CXTPToolBar* pToolBar = (CXTPToolBar*)pCommandBars->Add(_T("EditorTools"), xtpBarBottom);

 if (!pToolBar || !pToolBar->LoadToolBar(IDR_CHILDFRAME))
 {
         TRACE0("Failed to create toolbar\n");
         return -1;
 }

 pToolBar->ModifyStyle(CBRS_GRIPPER, 0);
 pToolBar->SetFlags(xtpFlagStretched);
 
 return 0;
}

The toolbar is now a proper child of the MDIChildWnd and is docked bottom, but hiding the gripper and customise toolbar button is proving to be problematic. The call to pToolBar->ModifyStyle(CBRS_GRIPPER, 0) has no effect.

 

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: 04 March 2004 at 12:56pm

call ModifyBarStyle instead ModifyStyle

set XTP_COMMANDBARS_OPTIONS::bShowExpandButtonAlways = FALSE

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.156 seconds.