Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Quick Access Buttons Inactive
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Quick Access Buttons Inactive

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

Joined: 08 November 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tsenoh Quote  Post ReplyReply Direct Link To This Post Topic: Quick Access Buttons Inactive
    Posted: 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
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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: 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
Back to Top
Tsenoh View Drop Down
Groupie
Groupie
Avatar

Joined: 08 November 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tsenoh Quote  Post ReplyReply Direct Link To This Post 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!
Back to Top
Tsenoh View Drop Down
Groupie
Groupie
Avatar

Joined: 08 November 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tsenoh Quote  Post ReplyReply Direct Link To This Post Posted: 09 November 2006 at 9:37am
P.S.

I create QuickAccess buttons like this:

m_pRibbonBar->GetQuickAccessControls()->Add(xtpControlButton, (UINT)pElement->dParameter1);
Back to Top
Tsenoh View Drop Down
Groupie
Groupie
Avatar

Joined: 08 November 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tsenoh Quote  Post ReplyReply Direct Link To This Post 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
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.078 seconds.