![]() |
toolbar button with subitems |
Post Reply
|
| Author | |
spelhatre
Newbie
Joined: 09 January 2006 Status: Offline Points: 15 |
Post Options
Thanks(0)
Quote Reply
Topic: toolbar button with subitemsPosted: 18 April 2007 at 9:32am |
|
I want to dynamically create a toolbar button with subitems in a dialogbox.
This is my code (pToolbar is my CXTPToolbar object): CXTPControlPopup* pControlPopup = CXTPControlPopup::CreateControlPopup(xtpControlSplitButtonPopup); pToolbar->GetControls()->Add( pControlPopup, 10 /*cmd id*/); CXTPControl* q = pControlPopup->GetControls()->Add( xtpControlButton, 10); q->SetCaption( "hello1"); q = pControlPopup->GetControls()->Add( xtpControlButton, 10 ); q->SetCaption( "hello2"); pToolbar ->GetParent()->RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 11); With this code, I have my button with the dropdown arrow (call it B1). But items "hello1" and "hello2" and not subitems or B1 but are also buttons in the toolbar. And I cannot use pControlPopup->GetCommandBar() object because it returns a NULL pointer. How to do this? thanks |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 18 April 2007 at 3:07pm |
|
Hello,
try something like:
CXTPControlPopup* pControlPopup = (CXTPControlPopup*)pToolbar->GetControls()->Add( xtpControlSplitButtonPopup, 10 /*cmd id*/);
CXTPControl* q = pControlPopup->GetCommandBar()->GetControls()->Add( xtpControlButton, 10); |
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
spelhatre
Newbie
Joined: 09 January 2006 Status: Offline Points: 15 |
Post Options
Thanks(0)
Quote Reply
Posted: 19 April 2007 at 3:55am |
|
thanks, it works.
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |