Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - ReportControl auto-numbering
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ReportControl auto-numbering

 Post Reply Post Reply
Author
Message
unknow View Drop Down
Groupie
Groupie
Avatar

Joined: 14 January 2009
Location: Belgium
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote unknow Quote  Post ReplyReply Direct Link To This Post Topic: ReportControl auto-numbering
    Posted: 02 November 2009 at 5:09pm

Hi. I would like to include an automatic line numbering column as seen in the ReportPaneView sample;

I understand it uses the "AssignIconViewPropNumAndIconNum" method but I can't get it working, the "rec#" column includes a copy of the 1st column which is text;
 
An additional question: how to force the current focused row to switch to edit mode for the 1st column (bAllowEdit is set and works with mouse).
 
Thankx !!
 
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 02 November 2009 at 5:58pm

void CReportPaneViewView::OnInitialUpdate()  {

CXTPReportView::OnInitialUpdate();

CString columnStr;

for (int i = 0; i < COL_NUMBER; i++) { columnStr.Format("Column %d",i);

CXTPReportColumn* pCol = GetReportCtrl().AddColumn(new CXTPReportColumn(i, columnStr, 60, FALSE,XTP_REPORT_NOICON,TRUE));

pCol->EnableResize(TRUE); }

for (int j = 0; j < ROW_NUMBER; j++)  GetReportCtrl().AddRecord(new CReportViewRecord(j));

GetReportCtrl().Populate();

GetReportCtrl().GetReportHeader()->SetAutoColumnSizing(FALSE);

GetReportCtrl().GetPaintManager()->SetColumnStyle(xtpReportColumnOffice2007);

GetReportCtrl().GetPaintManager()->SetDrawGridForEmptySpace(TRUE);

GetReportCtrl().GetPaintManager()->SetGridStyle(0, xtpReportGridSolid);

GetReportCtrl().GetPaintManager()->SetGridStyle(1, xtpReportGridSolid);

GetReportCtrl().GetPaintManager()->SetHeaderRowsDividerStyle(xtpReportFixedRowsDividerBold);

GetReportCtrl().GetPaintManager()->SetFooterRowsDividerStyle(xtpReportFixedRowsDividerBold);

GetReportCtrl().GetPaintManager()->m_clrHeaderRowsDivider = RGB(255,0,0);

GetReportCtrl().GetPaintManager()->m_clrFooterRowsDivider = RGB(0,0,255);

GetReportCtrl().AssignIconViewPropNumAndIconNum(-1, -1, TRUE, 20);

GetReportCtrl().GetPaintManager()->SetLastColumnWidthWYSIWYG(TRUE);

GetReportCtrl().GetPaintManager()->SetColumnWidthWYSIWYG(TRUE);

m_pPrintOptions->GetPageHeader()->m_strFormatString = "Header text: &p from &P";

m_pPrintOptions->GetPageFooter()->m_strFormatString = "Footer text: &D";

GetReportCtrl().m_bForcePagination = TRUE;

GetReportCtrl().AllowEdit(TRUE);

GetReportCtrl().EnableDragDrop(_T("ReportPaneView"), xtpReportAllowDragMove | xtpReportAllowDragCopy | xtpReportAllowDrop);

GetReportCtrl().GetPaintManager()->SetHeaderRowsDividerStyle(xtpReportFixedRowsDividerBold);

GetReportCtrl().GetPaintManager()->SetFooterRowsDividerStyle(xtpReportFixedRowsDividerBold);

GetReportCtrl().GetPaintManager()->SetDrawGridForEmptySpace(TRUE);

GetReportCtrl().GetPaintManager()->SetFreezeColsDividerStyle(xtpReportFreezeColsDividerThin | xtpReportFreezeColsDividerShowAlways);

GetReportCtrl().GetColumns()->GetFirstVisibleColumn()->SetAutoSize(FALSE);

GetReportCtrl().m_bDesktopTrackerMode = FALSE;

GetReportCtrl().RedrawControl();

}

Back to Top
unknow View Drop Down
Groupie
Groupie
Avatar

Joined: 14 January 2009
Location: Belgium
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote unknow Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2009 at 4:59pm
Thanks Mark, but I've already taken some portions of the code you posted;
 
My ReportControl is already implemented & working and I just want to add the 1st column with numbers.
 
As I wrote, the "rec#" column is present but I don't understand how to fill the value, instead of having numbers, I get a copy of the first column which contains text !!????
 
In this code you posted, which lines make the thing work ?
 
Thankx!
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2009 at 5:12pm
This is totally system-filled column - it show current row (or rec) index. I attach my code to show you the order of initialization steps. No need any other code to use number column but you can switch GetReportCtrl().GetPaintManager()->m_bRecOrRowNum = TRUE or FALSE
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.107 seconds.