![]() |
Quick Access Buttons Inactive |
Post Reply
|
| Author | |
Tsenoh
Groupie
Joined: 08 November 2006 Status: Offline Points: 69 |
Post Options
Thanks(0)
Quote Reply
Topic: Quick Access Buttons InactivePosted: 08 November 2006 at 12:17pm |
|
Hi!
I am rather new to XTP and having difficulties with some elements. I am trying to implement Ribbon Toolbar in a dialog in my application. Problem is with Quick Access. I managed to add buttons like in the sample application, but the buttons are inactive (no animation, and no command is sent when clicked). The ID's used for buttons are taken from IDR_MAINFRAME menu. What do I have to have in mind when implementing Ribbon in an Child-Dialog? Are there any tutorials on using XTP Controlls? Thanks! Bojan Hrnkas |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 08 November 2006 at 2:33pm |
|
Hello,
Add to message map
ON_MESSAGE(WM_KICKIDLE, OnKickIdle)
and method
LRESULT CDialogSampleDlg::OnKickIdle(WPARAM, LPARAM)
{ GetCommandBars()->UpdateCommandBars(); return 0; } now add all command handlers for command you need to message map.
See DialogSample project.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Tsenoh
Groupie
Joined: 08 November 2006 Status: Offline Points: 69 |
Post Options
Thanks(0)
Quote Reply
Posted: 09 November 2006 at 9:15am |
|
Thanks for the fast answer!
However, the problem still persists. The function OnKickIdle() is called only if Ribbon is not created. The thing is, I have only one class called FlexibleDlg, that is used for all dialogs in my application. Sometimes it schould have Ribbon Toolbar, sometimes not. I created the OnKickIdle() function like you suggested, and it is called only if I don't initialise Ribbon. I even had to put a check if ribbon is used or not, because when executing GetCommandBars()->UpdateCommandBars() on a dialog that has no toolbars, an exception is raised. Why is OnKickIdle not called? The only difference between a dialog with ribbon and the dialog without ribbon is following code: //create ribbon if needed if (m_bUseRibbon) { if (!InitCommandBars()) return -1; CXTPCommandBars* pCommandBars = GetCommandBars(); pCommandBars->SetTheme(xtpThemeRibbon); pCommandBars->GetImageManager()->SetIcons(IDR_SMALLNAV); m_pRibbonBar = (CXTPRibbonBar*)pCommandBars->Add(_T("The Ribbon"), xtpBarTop, RUNTIME_CLASS(CXTPRibbonBar)); if (!m_pRibbonBar) { return FALSE; } m_pRibbonBar->EnableDocking(0); m_pRibbonBar->GetTabPaintManager()->m_bSelectOnButtonDown = FALSE; CMenu menu; menu.CreateMenu(); menu.AppendMenu(MF_STRING, 1, "Fuktion 1"); menu.AppendMenu(MF_STRING, 2, "Fuktion 2"); CXTPControlPopup* pControlFile = (CXTPControlPopup*)m_pRibbonBar->AddSystemButton(0); pControlFile->SetCommandBar(&menu); CreateRibbonElements(); //CXTPRibbonTab* pTabHome = m_pRibbonBar->AddTab("Home (Test)"); m_pRibbonBar->GetQuickAccessControls()->CreateOriginalControls(); m_pRibbonBar->ShowQuickAccess(TRUE); m_pRibbonBar->SetCloseable(FALSE); m_pRibbonBar->EnableFrameTheme(); m_bRibbonCreated = TRUE; } What do I do wrong? Thanks! |
|
![]() |
|
Tsenoh
Groupie
Joined: 08 November 2006 Status: Offline Points: 69 |
Post Options
Thanks(0)
Quote Reply
Posted: 09 November 2006 at 9:37am |
|
P.S.
I create QuickAccess buttons like this: m_pRibbonBar->GetQuickAccessControls()->Add(xtpControlButton, (UINT)pElement->dParameter1); |
|
![]() |
|
Tsenoh
Groupie
Joined: 08 November 2006 Status: Offline Points: 69 |
Post Options
Thanks(0)
Quote Reply
Posted: 09 November 2006 at 10:28am |
|
I "kind of" solved the problem. Initially, I didn't have a message handler for the buttons ( OnNavFirst() ). Instead of that I had a single message handler "OnCommand" that was supposed to capture all commands and send coresponding message to the parent. I have to make it that way, because I will always have dynamically created controlls.
When I created a message handler for a single button in QuickAccessControls, all buttons were enabled, even those that have no message handler. I intend to leave a dummy message handler as a workaround. Is there a possibility to solve this in a more elegant way? Thanks! Bojan Hrnkas |
|
![]() |
|
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 |