Print Page | Close Window

Customization questions

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=12269
Printed Date: 07 October 2024 at 10:29am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Customization questions
Posted By: MadRiver
Subject: Customization questions
Date Posted: 26 September 2008 at 5:31pm
Hello,

Is there a white paper or tutorial that discusses runtime user Customization of toolbars and menus?

In C++, I am doing this:
   pCommandBars->EnableCustomization(VARIANT_TRUE);

    pControl = pControls->Add(xtpControlButton, M_FILE_NEW, "");
    pControl->PutDescriptionText(_bstr_t("Create a new document"));
    pDesignerControls->AddControl(pControl);

When I click on the arrow to open the Customization dialog,
I see this:


Why are the command items greyed out?

And the Customize dialog -- how do I populate it:


Thanks for any advice...









Replies:
Posted By: Oleg
Date Posted: 29 September 2008 at 3:49am
Hi,
 
Call EnableCustomize only after all menus/toolbars will be created - it will create "original" state of commandbars.


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


Posted By: MadRiver
Date Posted: 29 September 2008 at 8:59am
Thanks for the reply. 

The items in the Add/Remove dialog are now active.
However, there are no commands in the Customize/Actions tab.

When I create the toolbars, I add the controls to the DesignerControls collection:
    pControl = pControls->Add(xtpControlButton, M_FILE_NEW, "");
    pControl->PutDescriptionText(_bstr_t("Create a new document"));
    pDesignerControls->AddControl(pControl);

Or does the DesignerControls collection have to get populated in the Customization event handler?


Posted By: Oleg
Date Posted: 29 September 2008 at 2:42pm

Hi,

Yes you need fill DesignerControls. In Customization event or just in initialization code.


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


Posted By: MadRiver
Date Posted: 29 September 2008 at 3:00pm

Originally posted by oleg oleg wrote:

Hi,
Yes you need fill DesignerControls. In Customization event or just in initialization code.
I thought I was filling in the DesignerControls collection in 'initialization code'.    
// ------------------------------------    
// Create Standard Toolbar                                      // ------------------------------------    
ICommandBarPtr pToolbar = g_spCommandBars->Add(_bstr_t("WhammyBar"), xtpBarTop);    
pToolbar->PutBarID(ID_MAIN_TOOLBAR);    
pDesignerControls = g_spCommandBars->GetDesignerControls();    
pControls = pToolbar->GetControls();    
pControl = pControls->Add(xtpControlButton, M_FILE_NEW, "");    
pControl->PutDescriptionText(_bstr_t("Create a new document"));    
pDesignerControls->AddControl(pControl);


Posted By: strider
Date Posted: 07 November 2008 at 10:55am

I am having the same problem.  Do we need to clone the control, or just add the original one?



-------------
ActiveX 13.2.1

Strider


Posted By: dajya
Date Posted: 09 November 2008 at 9:12pm

I also have a same problem.

To fix it, i already scanned the sample code supported by extoolkit.

And i found out some clue. whenever i implement custom control or popuped control on the toolbar, then whole custom menu related to this toolbar turned disabled or grayed. Is it bugs? or did i commit any mistake?



Posted By: MadRiver
Date Posted: 20 November 2008 at 9:11am
Originally posted by strider strider wrote:

I am having the same problem.  Do we need to clone the control, or just add the original one?



The information in the help file suggests you can add an existing control:

AddControl Method
Adds an existing command bar control to the collection.

Has anyone made any progress on this problem?


-------------
Xtreme CommandBars ActiveX v 12.1.0



Posted By: Oleg
Date Posted: 20 November 2008 at 9:23am
Hi,
You can't add same control to toolbar and designers controls. Create it again : pDesignerControls->Add(xtpControlButton, etc)


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


Posted By: MadRiver
Date Posted: 20 November 2008 at 1:06pm
Originally posted by oleg oleg wrote:

Hi,
You can't add same control to toolbar and designers controls. Create it again : pDesignerControls->Add(xtpControlButton, etc)

What is AddControl() for, and how would you use it?
Is there an easy way to clone a control? CommandBarControl->Copy() needs a CommandBar for its first param.

-------------
Xtreme CommandBars ActiveX v 12.1.0




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