Print Page | Close Window

Dock CXTPToolBar at bottom of CMDIChildWn

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=480
Printed Date: 23 December 2024 at 11:57am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Dock CXTPToolBar at bottom of CMDIChildWn
Posted By: CamG
Subject: Dock CXTPToolBar at bottom of CMDIChildWn
Date 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;

}




Replies:
Posted By: SuperMario
Date 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?


Posted By: CamG
Date 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).



Posted By: CamG
Date 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.

 



Posted By: Oleg
Date Posted: 04 March 2004 at 12:56pm

call ModifyBarStyle instead ModifyStyle

set XTP_COMMANDBARS_OPTIONS::bShowExpandButtonAlways = FALSE



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net