Print Page | Close Window

dynamically add buttons to toolbar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=3560
Printed Date: 05 February 2025 at 12:52pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: dynamically add buttons to toolbar
Posted By: spelhatre
Subject: dynamically add buttons to toolbar
Date Posted: 25 January 2006 at 10:30am
I use control CXTPToolBar and dynamically add buttons:
toolbar->GetControls()->Add(xtpControlButton, ....)
But buttons and not drawn correctly.
I see only a part of the first button.
If my toolbar is floating, it's OK.
But if it is docked (at the top in my case) I have to undock it to see my buttons.

I tried several things but unsuccessfully:

CSize sz = toolbar->CalcDynamicLayout(0, LM_HORZ);
toolbar->SetWindowPos(&CWnd::wndTop, 0, 0, sz.cx, sz.cy, 0);

OR
 toolbar->GetParent()->RepositionBars(AFX_IDW_CON TROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

OR

toolbar->RedrawWindow();
toolbar->UpdateWindow();
toolbar->GetParent()->UpdateWindow();



Replies:
Posted By: Oleg
Date Posted: 25 January 2006 at 10:54am

Is it dialog application?



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


Posted By: spelhatre
Date Posted: 26 January 2006 at 2:11am



Posted By: spelhatre
Date Posted: 26 January 2006 at 2:11am
MDI application but the window with the dynamic toolbar is a dialogbox


Posted By: Oleg
Date Posted: 27 January 2006 at 12:54am

Just repeat code you have in OnSize, or call dialog OnSize as method

something:

CSize sz = toolbar->CalcDynamicLayout(0, LM_HORZ|LM_COMMIT);
toolbar->SetWindowPos(&CWnd::wndTop, 0, 0, sz.cx, sz.cy, SWP_NOMOVE);

 



-------------
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