Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Is it possible to put ribbon bar on a dialog
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Is it possible to put ribbon bar on a dialog

 Post Reply Post Reply
Author
Message
vijaymahajan View Drop Down
Groupie
Groupie
Avatar

Joined: 16 June 2008
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote vijaymahajan Quote  Post ReplyReply Direct Link To This Post Topic: Is it possible to put ribbon bar on a dialog
    Posted: 16 June 2008 at 5:23am

Hello,

I want to put the ribbon bar on a dialog,as my application is dialog based.
Is it possible to implement ribbon bar on a dialog?
I have implemented the ribbon bar in a MDI application,now i also have to put the ribbon bar in a dialog based application.But there is no sample code available to refer.
Please help me if anyone have any idea about implementing a ribbon bar in a dialog based application.
 
 
Thanks And Regards,
Vijay Mahajan.
 
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: 17 June 2008 at 12:41am
Hello,
 
Yes, its possible. See how DialogSample added Toolbars - use same way to add Ribbon.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Synapse View Drop Down
Groupie
Groupie


Joined: 28 June 2007
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote Synapse Quote  Post ReplyReply Direct Link To This Post Posted: 24 June 2008 at 8:34am
Hi,
I'm trying to add a ribbon to a dialog.
In the DialogSample project, in OnInitDialog(), I've added the following lines :

CXTPRibbonBar* pRibbonBar = (CXTPRibbonBar*)pCommandBars->Add(_T("The Ribbon"), xtpBarTop, RUNTIME_CLASS(CXTPRibbonBar));
    if (!pRibbonBar)
    {
        return FALSE;
    }
pRibbonBar->EnableDocking(0);


I have also commented the lines that were adding the menu and the toolbar.

The code compiles and launches, but the ribbon doesn't display in the dialog.
I thought that maybe it was because my ribbon was empty, so I've added an empty tab :
CXTPRibbonTab* pTabHome = pRibbonBar->AddTab("MyTab");

And now I have a crash on this line.

Thank you

Codejock Xtrem Skin Framework 2007 11.1.3
Windows XP SP2
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: 24 June 2008 at 9:30am

Hi,

You also need add Ribbon bitmaps to resources:
 
#include "Styles\Office2007Blue\Office2007Blue.rc"
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Synapse View Drop Down
Groupie
Groupie


Joined: 28 June 2007
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote Synapse Quote  Post ReplyReply Direct Link To This Post Posted: 24 June 2008 at 9:52am
I added this line to DialogSample.rc2 but it doesn't works. Do I need at list a tab in the ribbon to see something ?
Codejock Xtrem Skin Framework 2007 11.1.3
Windows XP SP2
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: 24 June 2008 at 3:11pm
Try also add pRibbon->SetMinimumVisibleWidth(0);
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Synapse View Drop Down
Groupie
Groupie


Joined: 28 June 2007
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote Synapse Quote  Post ReplyReply Direct Link To This Post Posted: 25 June 2008 at 3:29am
It still doesn't work. Here's my entire OnInitDialog() function

BOOL CDialogSampleDlg::OnInitDialog()
{
    CDialogSampleDlgBase::OnInitDialog();

    // Add "About..." menu item to system menu.

    // IDM_ABOUTBOX must be in the system command range.
    ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
    ASSERT(IDM_ABOUTBOX < 0xF000);

    CMenu* pSysMenu = GetSystemMenu(FALSE);
    if (pSysMenu != NULL)
    {
        CString strAboutMenu;
        strAboutMenu.LoadString(IDS_ABOUTBOX);
        if (!strAboutMenu.IsEmpty())
        {
            pSysMenu->AppendMenu(MF_SEPARATOR);
            pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
        }
    }

    // Set the icon for this dialog.  The framework does this automatically
    //  when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE);         // Set big icon
    SetIcon(m_hIcon, FALSE);        // Set small icon

    if (!m_wndStatusBar.Create(this) ||
        !m_wndStatusBar.SetIndicators(indicators,
        sizeof(indicators)/sizeof(UINT)))
    {
        TRACE0("Failed to create status bar\n");
        return -1;      // fail to create
    }
    m_wndStatusBar.SetPaneInfo(0, ID_SEPARATOR, SBPS_STRETCH, 100);

    VERIFY(InitCommandBars());

    OnTheme(ID_THEME_WHIDBEY);


    CXTPCommandBars* pCommandBars = GetCommandBars();
   
    XTPImageManager()->SetIcons(IDR_MAINFRAME);
    pCommandBars->GetCommandBarsOptions()->ShowKeyboardCues(xtpKeyboardCuesShowWindowsDefault);
    pCommandBars->GetToolTipContext()->SetStyle(xtpToolTipOffice);
    pCommandBars->GetShortcutManager()->SetAccelerators(IDR_ACCELERATOR);

    CXTPRibbonBar* pRibbonBar = (CXTPRibbonBar*)pCommandBars->Add(_T("The Ribbon"), xtpBarTop, RUNTIME_CLASS(CXTPRibbonBar));
    if (!pRibbonBar)
    {
        return FALSE;
    }
   
    CXTPRibbonTab* pTabHome = pRibbonBar->AddTab("MyTab");
    pRibbonBar->SetMinimumVisibleWidth(0);
    pRibbonBar->EnableDocking(0);


    LoadCommandBars(_T("CommandBars"));

    m_bInitDone = TRUE;

    return TRUE;  // return TRUE  unless you set the focus to a control
}


1) Why does the AddTab call crash ?
2) Do I need to add any ribbon operations outside of the OnInitDialog() function ?

Thank you.
Codejock Xtrem Skin Framework 2007 11.1.3
Windows XP SP2
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: 25 June 2008 at 4:17am
Hi,

Attach whole changed project.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Synapse View Drop Down
Groupie
Groupie


Joined: 28 June 2007
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote Synapse Quote  Post ReplyReply Direct Link To This Post Posted: 25 June 2008 at 4:35am
Here it is :
http://synapse.maintenance.free.fr/pub/DialogSample.rar
I use Visual Studio 8.
Codejock Xtrem Skin Framework 2007 11.1.3
Windows XP SP2
Back to Top
lanlamer View Drop Down
Newbie
Newbie


Joined: 18 January 2008
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote lanlamer Quote  Post ReplyReply Direct Link To This Post Posted: 13 September 2008 at 8:13am
Is the problem sovled or not? I also have the same problem.
Back to Top
lemongrass View Drop Down
Groupie
Groupie


Joined: 09 June 2006
Location: Austria
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote lemongrass Quote  Post ReplyReply Direct Link To This Post Posted: 16 September 2008 at 2:38pm
Hello,

 I've the same issueand one more:

 If I create several tabs, than I can see only controls I added to the first
 tab, all the other tabs show nothing at all. If I change the order of the tabs, than always the first one shows controls, the others not. What can I do, I really need ribbons in dialog based application.

Thanks a lot
Mario
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: 17 September 2008 at 2:27am
Hi,
 
Here modified working sample:
 
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
lemongrass View Drop Down
Groupie
Groupie


Joined: 09 June 2006
Location: Austria
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote lemongrass Quote  Post ReplyReply Direct Link To This Post Posted: 17 September 2008 at 1:02pm
Hi Oleg, thanks a LOT!
Back to Top
lemongrass View Drop Down
Groupie
Groupie


Joined: 09 June 2006
Location: Austria
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote lemongrass Quote  Post ReplyReply Direct Link To This Post Posted: 18 September 2008 at 2:01pm
Hello Oleg

 I found an issue with listboxes used in your dialog sample:



when I change back to MyTab, the Listbox remains



    CXTPRibbonTab* pTabHome = pRibbonBar->AddTab("MyTab");
    pTabHome->AddGroup("Group");

    CXTPRibbonTab* pTab2= pRibbonBar->AddTab("Tab2");
    CXTPRibbonGroup* pGroup = pTab2->AddGroup("Group2");


    CXTPControlListBox* pListMemory = new CXTPControlListBox();
    pGroup->Add(pListMemory, IDC_LIST);

    CXTPControlComboBox* pComboMemory = new CXTPControlComboBox();
    pGroup->Add(pComboMemory, IDC_COMBO);

Thanks
Mario



Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 19 September 2008 at 7:44am

Looks like the necessary WS_CLIPCHILDREN/WS_CLIPSIBLINGS-styles are missing. Correct?

Back to Top
lemongrass View Drop Down
Groupie
Groupie


Joined: 09 June 2006
Location: Austria
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote lemongrass Quote  Post ReplyReply Direct Link To This Post Posted: 19 September 2008 at 3:14pm
thanks, but adding

    CXTPControlListBox* pListMemory = new CXTPControlListBox();
    CListBox* pListBox = pListMemory->GetListCtrl();
    pListBox->ModifyStyle(0,WS_CLIPCHILDREN | WS_CLIPSIBLINGS);

doesn't solve this issue. But maybe I am doing something wrong here as well.

thanks a lot
mario
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: 22 September 2008 at 5:40am
Hello,
 
No, you are right :( CXTPControlListBox has problem in our code.
Please use Galleries instead. CXTPControlListBox was designed to be used for Popup menus only.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.188 seconds.