Print Page | Close Window

Adding toolbar button dynamically

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=16769
Printed Date: 05 July 2024 at 10:12am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Adding toolbar button dynamically
Posted By: sabapathy
Subject: Adding toolbar button dynamically
Date Posted: 29 May 2010 at 2:38am
I would like to add a button dynamically in the toolbar of my SDI application.
The toolbar type is CXTPToolBar.
How can do it and specify the style & type of control.
 
Thanks



Replies:
Posted By: Oleg
Date Posted: 30 May 2010 at 3:14am
Hi,

just
pToolBar->GetControls()->Add(xtpControlButton, ...);

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


Posted By: FrankC
Date Posted: 03 May 2011 at 4:33pm
Thanks Oleg.

According to your suggestion, I have tried the following code when creating the mainframe menubar.

However, the added button does not show up.  Do you think these code are correct?

Thanks,
Frank

CXTPCommandBars* pCommandBars = GetCommandBars();

CXTPMenuBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);

CXTPControls* pzMenuControls = pMenuBar->GetControls();

CXTPControl* pNewControl = pzMenuControls->Add(xtpControlButton, 100, "Manage");

DWORD dwFlags = pNewControl->GetFlags();

dwFlags |= xtpFlagRightAlign;

pNewControl->SetFlags(dwFlags);

pNewControl->SetVisible(TRUE);


Posted By: FrankC
Date Posted: 03 May 2011 at 5:58pm
Solved.

I have to clean the previously saved menu settings.

Thanks,
Frank



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