Print Page | Close Window

how to create ribbon bar in dialog

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=14784
Printed Date: 04 October 2024 at 6:01am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: how to create ribbon bar in dialog
Posted By: elizabeth.h1
Subject: how to create ribbon bar in dialog
Date Posted: 21 July 2009 at 7:21am
Hello

I  recently downloaded the evulation version of

ToolkitPro for Visual C++. And I am trying to create ribbon bar on dialog. I searched the documentation code samples but could not find nothing similar. I also searched the posts, with no luck.
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





Replies:
Posted By: Oleg
Date Posted: 22 July 2009 at 4:03am
Hello,
 
Start from DialogSample we have and replace standard Toolbar to RibbonBar.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: rebmem
Date Posted: 17 August 2012 at 5:02am
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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net