![]() |
How to add commandbars to MDIChild window? |
Post Reply ![]() |
Author | |
Howard Farseer ![]() Groupie ![]() Joined: 30 September 2007 Status: Offline Points: 30 |
![]() ![]() ![]() ![]() ![]() Posted: 31 May 2008 at 1:20am |
I've tried my way like this:
VERIFY(m_wndToolBar.CreateToolBar(WS_VISIBLE | WS_CHILD |
CBRS_TOOLTIPS | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, this)); VERIFY(m_wndToolBar.LoadToolBar(IDR_SPLIT_ADDRESSBAR/*IDR_EXPLORER_BAR*/)); but this toolbar doesn't has all features as toolbars in main frame window.
Especially it has no effect when i set xtpFlagStretched flag,.The custom control didn't stretch while the same one in mainwnd toolbar did.
|
|
![]() |
|
mgampi ![]() Senior Member ![]() ![]() Joined: 14 July 2003 Status: Offline Points: 1201 |
![]() ![]() ![]() ![]() ![]() |
Hi, |
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
![]() |
|
Howard Farseer ![]() Groupie ![]() Joined: 30 September 2007 Status: Offline Points: 30 |
![]() ![]() ![]() ![]() ![]() |
thank you very much! It really works!
|
|
![]() |
|
Shinonome ![]() Groupie ![]() Joined: 18 July 2008 Status: Offline Points: 78 |
![]() ![]() ![]() ![]() ![]() |
I want to attach the toolbar in MDI child window of a CWnd.
It doesn't function though it wrote referring to 'http://forum.codejock.com/forum_posts.asp?TID=9230'. I want to write it on the class that derives from not CMDIChildWnd but CWnd. What is insufficient? 1) Create MDI Application without Document/View architecture. 2) Add OnCreate method in CChildView. 3) Edit OnCreate method, Constructor and destructor. ------------------------------------------------------------------------- class CChildView : public CWnd { public: CChildView() ; virtual ~CChildView() ; protected : virtual BOOL PreCreateWindow( CREATESTRUCT& cs ) ; protected : afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct ) ; afx_msg void OnPaint() ; DECLARE_MESSAGE_MAP() CXTPCommandBars* m_lpxtpCmdBars ; } ; CChildView::CChildView() { m_lpxtpCmdBars = CXTPCommandBars::CreateCommandBars() ; } CChildView::~CChildView() { m_lpxtpCmdBars->InternalRelease() ; } BEGIN_MESSAGE_MAP( CChildView, CWnd ) ON_WM_PAINT() ON_WM_CREATE() END_MESSAGE_MAP() BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs) { if( ! CWnd::PreCreateWindow( cs )) return FALSE ; cs.dwExStyle |= WS_EX_CLIENTEDGE; cs.style &= ~WS_BORDER; cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS, ::LoadCursor( NULL, IDC_ARROW ), reinterpret_cast< HBRUSH >( COLOR_WINDOW + 1 ), NULL ) ; return TRUE ; } void CChildView::OnPaint() { CPaintDC dc( this ) ; } int CChildView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if( CWnd::OnCreate(lpCreateStruct ) == -1 ) return -1 ; m_lpxtpCmdBars->GetToolTipContext()->SetStyle( xtpToolTipStandard ) ; m_lpxtpCmdBars->SetSite( this ) ; m_lpxtpCmdBars->EnableCustomization( FALSE ) ; m_lpxtpCmdBars->EnableDocking(); // Create ToolBar CXTPToolBar* lpxtpToolBar = (CXTPToolBar*)m_lpxtpCmdBars->Add( L"Standard", xtpBarBottom ) ; if( ! lpxtpToolBar || !lpxtpToolBar->LoadToolBar( IDR_MAINFRAME )) { TRACE0( "Failed to create toolbar\n" ) ; return -1 ; } lpxtpToolBar->SetShowGripper( FALSE ) ; lpxtpToolBar->ShowExpandButton( FALSE ) ; lpxtpToolBar->EnableDocking( xtpFlagAlignBottom ) ; return 0 ; } ------------------------------------------------------------------------- ![]() |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Also catch OnSize and add
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Shinonome ![]() Groupie ![]() Joined: 18 July 2008 Status: Offline Points: 78 |
![]() ![]() ![]() ![]() ![]() |
I was quite inconsiderate in OnSize.
Thank you Oleg ! ![]() |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |