Jump to content
Software FX Community

Re: AddCommand/VC++ problem


User (Legacy)
 Share

Recommended Posts

Good morning! 

I am not sure about the solution to your problem, but here is sample code

that works for me....

ICommandBar *commands;

IToolBar *toolbar;

m_pChartFX->get_Commands(&commands);

commands->AddCommand(CFDC_COMMANDZOOM);

commands->AddCommand(CFDC_COMMANDZOOMONBASE);

commands->AddCommand(CFDC_ADDTIMEPOINTS);

commands->Item[CFDC_COMMANDZOOM]->Picture = 7;

commands->Item[CFDC_COMMANDZOOM]->Text = "Zoom";

commands->Item[CFDC_COMMANDZOOMONBASE]->Picture = 3;

commands->Item[CFDC_COMMANDZOOMONBASE]->Text = "Zoom On Base Data";

CPictureHolder pPict;

short pictloc;

pPict.CreateFromBitmap(IDB_CFX_ADDTIMEPTS);

pictloc = commands->AddPicture((IPictureDisp *)pPict.GetPictureDispatch());

commands->Item[CFDC_ADDTIMEPOINTS]->Style = (CommandItemStyle)CBIS_TWOSTATE;

commands->Item[CFDC_ADDTIMEPOINTS]->Picture = pictloc;

commands->Item[CFDC_ADDTIMEPOINTS]->Text = "Add Time Points";

m_pChartFX->get_ToolBarObj(&toolbar);

toolbar->AddItems(3, 11);

toolbar->PutitemCommandID(11, CFDC_COMMANDZOOM);

toolbar->PutitemCommandID(12, CFDC_COMMANDZOOMONBASE);

toolbar->PutitemCommandID(13, CFDC_ADDTIMEPOINTS);

I hope this helps you.

--

josh

Tim Shearer <tshearer@symmetricom.com> wrote in message

news:DE0379D14694D211B4CE00609770710D05136E@sftfx-221.wamnet.net...

> I'm using ChartFX 98/4.0, can I wish to add a new command(40), with

ToolTip

> text of 'MyPrint' and the 'Printer' icon, at location 10 of the ToolBar.

> Why doesn't this work?????

>

> m_pChartFX->Commands->AddCommand(40);

> m_pChartFX->ToolBarObj->AddItems(1,10);

> m_pChartFX->Commands->PutitemText( 40, "MyPrint" );

> m_pChartFX->Commands->PutitemPicture( 40, 2 );

> m_pChartFX->ToolBarObj->Item[10]->CommandID = 40;

>

>

> This kinda works ... however, the icon displayed in the 10th tool location

> is the Open Folder, and the ToolTip text says 'Solid'. When I click on

that

> icon, I am taken to the UserCommand command handler function, which is

what

> I want. But why aren't the icon & ToolTip text changed???

>

> Can anyone show me working VC++ code, please? I'm very disappointed in

lack

> of C++ type sample code.

>

> Thanks,

> Tim

>

>

>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...