Print Page | Close Window

Shortcut Keys....

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=15697
Printed Date: 27 February 2025 at 8:55am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Shortcut Keys....
Posted By: ddlittle
Subject: Shortcut Keys....
Date 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



Replies:
Posted By: Smucker
Date 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)




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net