Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - HOWTO: Multi row (-line) header?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

HOWTO: Multi row (-line) header?

 Post Reply Post Reply
Author
Message
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Topic: HOWTO: Multi row (-line) header?
    Posted: 23 November 2011 at 12:42pm
Hi;

Is it possible to create a multi row header in report control as shown in this screenshot?



I don't want to use header rows collection, because I want the resize/move/order columns functionality of the default report header.
Do I have to create my own header control????

TIA
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Posted: 23 November 2011 at 11:44pm
Hello Martin,

this is currently not supported, but I already have it on my todo list.

Andre

Codejock support
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2011 at 5:12am
When finished? An estimate, please!
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 19 April 2012 at 10:46am
Any news on this issue?
When will it be available?
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 18 December 2014 at 4:52am
Hello Martin,

You can use CXTPReportControl::m_pSectionHeader  with merged cells   as multiline header. For example see  ReportSample   -> menu -> "REPORT CONTROL" -> "Control test" -> "Merge test"

Change CMergeView::OnCreate  for code below

toolkitpro\Samples\ReportControl\ReportSample\MergeView.cpp  
int CMergeView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CXTPReportView::OnCreate(lpCreateStruct) == -1)
return -1;

CXTPReportControl& wndReport = GetReportCtrl();

wndReport.GetPaintManager()->SetGridStyle(TRUE, xtpReportGridSolid);
wndReport.ShowGroupBy(FALSE);
wndReport.ShowHeaderRows(TRUE);

int nColumnCount = 7;
int nHeaderCount = 2;
int nRecordCount = 10;
int nColumn;
int nRecord;

CXTPReportRecord *pRecord = NULL;

for (nColumn=0; nColumn<nColumnCount; nColumn++)
{
CXTPReportColumn *pColumn = new CXTPReportColumn(nColumn, _T(""), 90, TRUE);
pColumn = wndReport.AddColumn(pColumn);
}

// Add header records
for (nRecord=0; nRecord<nHeaderCount; nRecord++)
{
pRecord = wndReport.GetHeaderRecords()->Add(new CXTPReportRecord());
for (nColumn=0; nColumn<nColumnCount; nColumn++)
{
CXTPReportRecordItemText *pItem = new CXTPReportRecordItemText();
pItem->SetBackgroundColor(RGB(223,227,232));
pItem->SetAlignment(xtpColumnTextCenter|xtpColumnTextVCenter);
pRecord->AddItem(pItem);
}
}

// Create multiline header
wndReport.HeaderRowsAllowSort(FALSE);
wndReport.HeaderRowsAllowGroup(FALSE);
wndReport.HeaderRowsAllowAccess(FALSE);

pRecord = wndReport.GetHeaderRecords()->GetAt(0);
pRecord->GetItem(0)->SetCaption(_T("1"));
pRecord->GetItem(3)->SetCaption(_T("Vehicle Id"));
pRecord->GetItem(5)->SetCaption(_T("Last multiline column header"));

pRecord = wndReport.GetHeaderRecords()->GetAt(1);
pRecord->GetItem(0)->SetCaption(_T("First"));
pRecord->GetItem(1)->SetCaption(_T("Second"));
pRecord->GetItem(2)->SetCaption(_T("Third"));
pRecord->GetItem(3)->SetCaption(_T("Fourth"));
pRecord->GetItem(4)->SetCaption(_T("Fifth"));

#if _XTPLIB_VERSION_PREFIX >= 1511
wndReport.GetHeaderRecords()->MergeItems(CXTPReportRecordItemRange(0,2,0,0));
wndReport.GetHeaderRecords()->MergeItems(CXTPReportRecordItemRange(3,4,0,0));
wndReport.GetHeaderRecords()->MergeItems(CXTPReportRecordItemRange(5,6,0,1));
#endif

// Add records
for (nRecord=0; nRecord<nRecordCount; nRecord++)
{
pRecord = wndReport.AddRecord(new CXTPReportRecord());
for (nColumn=0; nColumn<nColumnCount; nColumn++)
{
CString sText;
sText.Format(_T("Row %d, %d"), nRecord, nColumn);

CXTPReportRecordItemText *pItem = new CXTPReportRecordItemText(sText);
pRecord->AddItem(pItem);
}
}

wndReport.Populate();
wndReport.SetFocus();

return 0;
}
 
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 18 December 2014 at 4:56am
Thanks;

I'll give it a try...
But as I remember header records are not the same as the report header. So am I the no longer possible to resize columns when I  hide the original report header?
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 18 December 2014 at 7:58am

Originally posted by mgampi mgampi wrote:

But as I remember header records are not the same as the report header. So am I the no longer possible to resize columns when I  hide the original report header?
Yes, you are right. But it is so close to desirable appearance.





Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 18 December 2014 at 8:00am
In this case it's not usable for me!
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
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.141 seconds.