Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - XTPQuickAccessToobar will not save/load control
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

XTPQuickAccessToobar will not save/load control

 Post Reply Post Reply
Author
Message
Andrew Beardsley View Drop Down
Newbie
Newbie
Avatar

Joined: 03 June 2016
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Andrew Beardsley Quote  Post ReplyReply Direct Link To This Post Topic: XTPQuickAccessToobar will not save/load control
    Posted: 03 June 2016 at 4:25pm
I can r-click a custom control and add it to my Quick Access Toolbar. I can also add it through More Commands from the QAT dropdown. They work until i close and re-open the application. something is going horribly wrong with my save or load. The code below was borrowed from another Codejock user named Dan.

here is the Code i am using:
/code

Load:
SaveLoadQAC(CFile::modeRead, CFile::shareExclusive, CArchive::load);
Save:
SaveLoadQAC(CFile::modeCreate, CFile::modeWrite, CArchive::store);
void CESHAMainFrame::SaveLoadQAC(CFile::OpenFlags Flag1, CFile::OpenFlags Flag2,CArchive::Mode mode)
{
    CFile fSettings;
    if (fSettings.Open(m_sSettingsFilePath, Flag1 | Flag2))
    {
        CArchive ar(&fSettings, mode);
        CXTPPropExchangeArchive px(ar);
 
        CXTPRibbonQuickAccessControls *pQA = m_pRibbonBar->GetQuickAccessControls();
        XTP_COMMANDBARS_PROPEXCHANGE_PARAM param;
        if (mode == CArchive::load)
        {
            param.pCommandBars = GetCommandBars();
        }
        param.bSaveOnlyCustomized = FALSE;
        param.bLoadSilent = TRUE;
        param.bSaveOriginalControls = TRUE;
        param.bSerializeActions = TRUE;
        param.bSerializeControls = TRUE;
        param.bSerializeDesignerControls = TRUE;
        param.bSerializeImages = FALSE;
        param.bSerializeLayout = TRUE;
        param.bSerializeOptions = TRUE;
        px.m_dwData = DWORD_PTR(&param);
        pQA->DoPropExchange(&px);
        ar.Close();
        fSettings.Close();
    }
}
~Edit:
So after some other defect fixes, i found that we were incorrectly using some xtpControlSplitButtonPopup controls and i changed them to xtpControlButtonPopup.
This allowed the same buttons to be used and saved in the QAT. I have since removed the above method and i am now just calling:
SaveCommandBars(_T("ESHACommandBar"));
and
LoadCommandBars(_T("ESHACommandBar"));
~Andrew
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.156 seconds.