Print Page | Close Window

Report control

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2249
Printed Date: 08 November 2025 at 3:56am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Report control
Posted By: JGranborg
Subject: Report control
Date Posted: 18 May 2005 at 10:50am

I like to save the state of the report control when the user leaves it

or alternative

Start with som grouping based on one of the columns

Does any of the examples give some help.

 



-------------
Jørgen Granborg



Replies:
Posted By: bevpet
Date Posted: 18 May 2005 at 1:39pm

 

look at the report grid same, it has the functions to save/restore the state of a reportbar.

(...\Codejock Software\MFC\Xtreme Toolkit Pro\Samples\ReportControl\ReportSample)

void CReportSampleView::LoadReportState()

{

#ifdef XML_STATE

CXTPPropExchangeXMLNode px(TRUE, 0, _T("ReportControl"));

if (!px.LoadFromFile(_T("c:\\ReportControl.xml")))

return;

m_wndReport.DoPropExchange(&px);

#else

UINT nBytes = 0;

LPBYTE pData = 0;

if (!AfxGetApp()->GetProfileBinary(_T("ReportControl"), _T("State"), &pData, &nBytes))

return;

CMemFile memFile(pData, nBytes);

CArchive ar (&memFile,CArchive::load);

try

{

m_wndReport.SerializeState(ar);

}

catch (COleException* pEx)

{

pEx->Delete ();

}

catch (CArchiveException* pEx)

{

pEx->Delete ();

}

ar.Close();

memFile.Close();

delete[] pData;

#endif

}

void CReportSampleView::SaveReportState()

{

#ifdef XML_STATE

CXTPPropExchangeXMLNode px(FALSE, 0, _T("ReportControl"));

m_wndReport.DoPropExchange(&px);

px.SaveToFile(_T("c:\\ReportControl.xml"));

#else

CMemFile memFile;

CArchive ar (&memFile,CArchive::store);

m_wndReport.SerializeState(ar);

ar.Flush();

DWORD nBytes = (DWORD)memFile.GetPosition();

LPBYTE pData = memFile.Detach();

AfxGetApp()->WriteProfileBinary(_T("ReportControl"), _T("State"), pData, nBytes);

ar.Close();

memFile.Close();

free(pData);

#endif

}

HTH

Peter

 



Posted By: JGranborg
Date Posted: 18 May 2005 at 1:42pm
Thanks a lot great input

-------------
Jørgen Granborg



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