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(¶m);
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
|