Print Page | Close Window

Report Control CustomDrawReport

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=23288
Printed Date: 26 April 2024 at 10:40pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Report Control CustomDrawReport
Posted By: Andy121070
Subject: Report Control CustomDrawReport
Date Posted: 14 March 2017 at 6:11am
I am in the process of looking at generating a report that looks similar to the CustomDrawReport.exe sample.  I have had a look at the samples and sample source code but can't find anything relating to how you get a report row to display like the sample above.

Does anyone have any example source code of this in use that I can take a look at?



-------------
Regards

Andy



Replies:
Posted By: olebed
Date Posted: 14 March 2017 at 8:44am
Hello Andy121070,

Initialization of ReportControl is in CCustomDrawReportDlg::OnInitDialog()
    //  Add sample columns
    //

    m_wndReportCtrl.AddColumn(new CXTPReportColumn(REPORTCOLUMN_NAME, _T("Name"), 150));
    m_wndReportCtrl.AddColumn(new CXTPReportColumn(REPORTCOLUMN_ATTR1, _T("Attribute 1"), 150));
    m_wndReportCtrl.AddColumn(new CXTPReportColumn(REPORTCOLUMN_ATTR2, _T("Attribute 2"), 150));
    m_wndReportCtrl.AddColumn(new CXTPReportColumn(REPORTCOLUMN_ATTR3, _T("Attribute 3"), 150));
    m_wndReportCtrl.GetColumns()->GetAt(REPORTCOLUMN_ATTR3)->SetAlignment(DT_VCENTER);

    //
    //  Add sample records in tree
    //

    CString strName;
    CString strProgress;
    for(int i = 0; i < 10; i++)
    {
        strName.Format(_T("Parameter %d"), i);
        strProgress.Format(_T("Progress %d: (%d%%)"), i, 0);
        m_wndReportCtrl.AddRecord(new CMessageRecord(strName, 4, i, 4, 1 << (i & 3), strProgress, RGB(0, 0, 100), 15, 0, 100, i + 1, 0));
    }

    //
    // define style attributes for the report control.
    //

    m_wndReportCtrl.GetColumns()->Find(REPORTCOLUMN_NAME)->SetTreeColumn(TRUE);

    CXTPCustomDrawReportPaintManager* pPaintManager = new CXTPCustomDrawReportPaintManager(this);

    m_wndReportCtrl.SetPaintManager(pPaintManager);

    //
    // after columns and data have been added call Populate to 
    // populate all of the date for the control.
    //

    m_wndReportCtrl.Populate();


Every row described by class CMessageRecord which contents 4 items CXTPReportRecordItemText, CMessageRecordItemCheckGroup, CMessageRecordItemRadioGroup, CXTPReportRecordItemProgress.

CXTPReportRecordItemText and CXTPReportRecordItemProgress are drawed as default.
CMessageRecordItemCheckGroup and CMessageRecordItemRadioGroup are drawed with method CCustomDrawReportDlg::DrawItem().  You can set breakpoints to see callstack.

Regards,
 Oleksandr Lebed


Posted By: Andy121070
Date Posted: 15 March 2017 at 5:05am
Thank you for the response Oleksandr

Should I be able to find the full source code file in any of the CodeJock sample source code?  If so, which one do I need to look at?


-------------
Regards

Andy


Posted By: olebed
Date Posted: 15 March 2017 at 6:30am
you can open sample project
c:\Program Files (x86)\Codejock Software\MFC\Xtreme ToolkitPro v17.3.0\Samples\ReportControl\ReportCustomDraw\CustomDrawReport_vc140.sln

and see in Solution Explorer all files of sample.

Source files of ReportControl you can find in c:\Program Files (x86)\Codejock Software\MFC\Xtreme ToolkitPro v17.3.0\Source\ReportControl\

Better way is to add ToolkitPro project to solution of sample ReportCustomDraw. You can find project of ToolkitPro in c:\Program Files (x86)\Codejock Software\MFC\Xtreme ToolkitPro v17.3.0\Workspace\ToolkitPro\ToolkitProShared_vc140.vcxproj

Then with using debugging and breakpoints in methods you can explore how ReportControl works.


Posted By: Andy121070
Date Posted: 15 March 2017 at 6:39am
Thanks for that.  That would explain why I can't find the sample.  We only have the ActiveX version of the controls.



-------------
Regards

Andy



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