Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - toolbar button with subitems
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

toolbar button with subitems

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


Joined: 09 January 2006
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote spelhatre Quote  Post ReplyReply Direct Link To This Post Topic: toolbar button with subitems
    Posted: 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

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: 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
Back to Top
spelhatre View Drop Down
Newbie
Newbie


Joined: 09 January 2006
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote spelhatre Quote  Post ReplyReply Direct Link To This Post Posted: 19 April 2007 at 3:55am
thanks, it works.
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.156 seconds.