Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Shortcut Keys....
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Shortcut Keys....

 Post Reply Post Reply
Author
Message
ddlittle View Drop Down
Senior Member
Senior Member


Joined: 19 February 2004
Location: United States
Status: Offline
Points: 132
Post Options Post Options   Thanks (0) Thanks(0)   Quote ddlittle Quote  Post ReplyReply Direct Link To This Post Topic: Shortcut Keys....
    Posted: 23 November 2009 at 11:00am

I added a CXTPCustomizeKeyboardPage to my customize toolbars and it seems to work fine.  The next step is to make the changes persistant, but this code doesn't seem to save anything:


GetCommandBars()->GetShortcutManager()->SaveShortcuts("Input Hotkeys");
 
which means that nothing happens when I call this in CMainFrame::OnCreate():

GetCommandBars()->GetShortcutManager()->LoadShortcuts("Input Hotkeys");
 
I couldn't find any samples containing SaveShortcuts, but I did notice that Load/SaveCommandBars() contains a call to matching shortcut functions, but my user-defined hotkeys remain non-persistent.
 
Any ideas? 
 
Thanks!
 
- David
Back to Top
Smucker View Drop Down
Senior Member
Senior Member
Avatar

Joined: 02 February 2008
Status: Offline
Points: 156
Post Options Post Options   Thanks (0) Thanks(0)   Quote Smucker Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2009 at 12:22pm
I save my command bars, shortcuts, customize options, and docking panes to an XML file. This works for me:

void CMainFrame::ExchangeLayout(CXTPPropExchange* pPX, BOOL bSerializeControls /*= TRUE*/)
{
    XTP_COMMANDBARS_PROPEXCHANGE_PARAM param;
    param.bSerializeControls = bSerializeControls;
    param.bSerializeOptions = TRUE;

    CXTPPropExchangeSection pxCommandBars(pPX->GetSection(_T("CommandBars")));
    GetCommandBars()->DoPropExchange(&pxCommandBars, &param);

    CXTPPropExchangeSection secShortcuts(pPX->GetSection(_T("Shortcuts")));
    GetCommandBars()->GetShortcutManager()->DoPropExchange(&secShortcuts);

    CXTPPropExchangeSection pxDockingPane(pPX->GetSection(_T("DockingPane")));   
    m_paneManager.DoPropExchange(&pxDockingPane);
}


In CMainFrame::OnCreate():

    CXTPPropExchangeXMLNode px(TRUE, 0, _T("Settings"));      // To serialize to XML file
    if (px.LoadFromFile(::g_XmlIniFile)) {
        CXTPPropExchangeSection pxNormalLayout(px.GetSection(_T("NormalLayout")));
        ExchangeLayout(&pxNormalLayout);
    }

in CMainFrame::OnClose():

    CXTPPropExchangeXMLNode px(FALSE, 0, _T("Settings"));      // To serialize to XML file
    if (px.OnBeforeExchange())  {
        CXTPPropExchangeSection pxNormalLayout(px.GetSection(_T("NormalLayout")));
        ExchangeLayout(&pxNormalLayout);
        px.SaveToFile(::g_XmlIniFile);
    }

Hope this helps.


Product: Xtreme Toolkit Pro version 13.2 (Unicode, static build)

Platform: Windows 200x/XP/Vista/Win7 (32/64 bit)

Language: Visual C++ 9.0 (Studio 2008)

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.045 seconds.