how to create ribbon bar in dialog |
Post Reply |
Author | |
elizabeth.h1
Newbie Joined: 21 July 2009 Status: Offline Points: 1 |
Post Options
Thanks(0)
Posted: 21 July 2009 at 7:21am |
Hello
I recently downloaded the evulation version of Here is what I tried so far : // This is DialogRibbonBar.h #define CDialogSampleDlgBase CXTPDialogBase<CXTResizeDialog> class CDialogsoRibbonDlg : public CDialogSampleDlgBase { // Construction public: CDialogsoRibbonDlg(CWnd* pParent = NULL); // standard constructor enum { IDD = IDD_DIALOGSORIBBON_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support protected: virtual BOOL OnInitDialog(); DECLARE_MESSAGE_MAP() }; /// This is DialogRibbonBar.cpp #include "stdafx.h" #include " DialogRibbonBar.h " CDialogsoRibbonDlg::CDialogsoRibbonDlg(CWnd* pParent /*=NULL*/) : CDialogSampleDlgBase(CDialogsoRibbonDlg::IDD, pParent) { } void CDialogsoRibbonDlg::DoDataExchange(CDataExchange* pDX) { CDialogSampleDlgBase::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CDialogsoRibbonDlg, CDialogSampleDlgBase) //{{AFX_MSG_MAP(CDialogSampleDlg) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDialogSampleDlg message handlers BOOL CDialogsoRibbonDlg::OnInitDialog() { CDialogSampleDlgBase::OnInitDialog(); VERIFY(InitCommandBars()); CXTPCommandBars* pCommandBars = GetCommandBars(); CXTPRibbonBar* pRibbonBar = (CXTPRibbonBar*)pCommandBars->Add(_T("The Ribbon"), xtpBarTop, RUNTIME_CLASS(CXTPRibbonBar)); pRibbonBar->AddTab(L"Hello"); pRibbonBar->AddTab(L"Hello again"); return TRUE; // return TRUE unless you set the focus to a control } The code that calls the dialog is in the InitInstance of my dialog based application : CDialogsoRibbonDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal() Can someone review my code and tell my what I am missing , because the dialog box shows no ribbon bar at all. Thank you |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
Start from DialogSample we have and replace standard Toolbar to RibbonBar.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
rebmem
Newbie Joined: 17 August 2012 Status: Offline Points: 1 |
Post Options
Thanks(0)
|
i think you should see again OnInitDialog in DialogSample application. There is a function that plays a role very importantly. It's "RepositionControls" function. When i delete it, there is no command bar. May be it makes command bars appear.
|
|
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 |