Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Programmatic creation of toolbars
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Programmatic creation of toolbars

 Post Reply Post Reply
Author
Message
aznodak View Drop Down
Newbie
Newbie


Joined: 26 July 2005
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote aznodak Quote  Post ReplyReply Direct Link To This Post Topic: Programmatic creation of toolbars
    Posted: 10 August 2006 at 12:50am

I need to dynamically create a toolbar programmatically without using the apps resource. The user should not be able to modify the toolbar.

The filenames of the toolbar images will be in an simple ascii config file. I need to tie notification of a toolbar button being activated to a unique id I will create on the fly. One function needs to catch all button activation and extract the unique id. Won't know how many buttons will be created until the config file is loaded.

There are so many classes to dig through, so far I have not found anything that directly addresses what I need to do.
 
Any hints on where to start?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 14 August 2006 at 9:13am
Hi,
 
start from Help :) see CXTPControl, CXTPControls, CXTPCommandBar:
 
something like:
 
pToolBar->GetControls()->Add(xtpControlButton, Id);
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
akur View Drop Down
Senior Member
Senior Member


Joined: 16 May 2006
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote akur Quote  Post ReplyReply Direct Link To This Post Posted: 08 September 2006 at 1:39am
I went through this too in the past, maybe this will help you e.g. to create a toolbar in a CXTPDialog.

Creating the toolbar:
    CXTPToolbar *pToolbar = GetCommandBars()->Add(_T("Your Toolbar Name"), xtpBarTop);

Adding a button to this toolbar:
    CXTPControl *pButton = new CXTPControlButton();
    pButton->SetID(nYourButtonID);
    pButton->SetCustomIcon(hYourIconHandle);
    pButton->SetCaption(strYourCaptionText);
    pButton->SetTooltip(strYourTooltipText);
    // Insert button to toolbar:
    pToolbar->GetControls()->Add(pButton);


Hope this helps.

Back to Top
Sstar9 View Drop Down
Newbie
Newbie


Joined: 25 August 2006
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sstar9 Quote  Post ReplyReply Direct Link To This Post Posted: 11 September 2006 at 9:43pm

For the Programmatically generated CommandBar, is there any way we could programmtically add a Seperator in between the Controls?

 

 

Sharing makes life better
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 12 September 2006 at 12:27am
Hi,
pButton->SetBeginGroup(TRUE);
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Sstar9 View Drop Down
Newbie
Newbie


Joined: 25 August 2006
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sstar9 Quote  Post ReplyReply Direct Link To This Post Posted: 12 September 2006 at 1:49am
Thank you.. Oleg
Sharing makes life better
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.