Is it possible to put ribbon bar on a 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=11048
Printed Date: 01 February 2025 at 7:49am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Is it possible to put ribbon bar on a dialog
Posted By: vijaymahajan
Subject: Is it possible to put ribbon bar on a dialog
Date 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.
|
Replies:
Posted By: Oleg
Date 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
|
Posted By: Synapse
Date 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
|
Posted By: Oleg
Date 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
|
Posted By: Synapse
Date 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
|
Posted By: Oleg
Date Posted: 24 June 2008 at 3:11pm
Try also add pRibbon->SetMinimumVisibleWidth(0);
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: Synapse
Date 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
|
Posted By: Oleg
Date Posted: 25 June 2008 at 4:17am
Hi,
Attach whole changed project.
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: Synapse
Date Posted: 25 June 2008 at 4:35am
Here it is : http://synapse.maintenance.free.fr/pub/DialogSample.rar - http://synapse.maintenance.free.fr/pub/DialogSample.rar I use Visual Studio 8.
------------- Codejock Xtrem Skin Framework 2007 11.1.3
Windows XP SP2
|
Posted By: lanlamer
Date Posted: 13 September 2008 at 8:13am
Is the problem sovled or not? I also have the same problem.
|
Posted By: lemongrass
Date 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
|
Posted By: Oleg
Date Posted: 17 September 2008 at 2:27am
Hi,
Here modified working sample:
http://forum.codejock.com/uploads/20080917_022718_ds.zip - ds.zip
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: lemongrass
Date Posted: 17 September 2008 at 1:02pm
Posted By: lemongrass
Date 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
|
Posted By: znakeeye
Date Posted: 19 September 2008 at 7:44am
Looks like the necessary WS_CLIPCHILDREN/WS_CLIPSIBLINGS-styles are missing. Correct?
|
Posted By: lemongrass
Date 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
|
Posted By: Oleg
Date 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
|
|