ReportControl auto-numbering |
Post Reply |
Author | |
unknow
Groupie Joined: 14 January 2009 Location: Belgium Status: Offline Points: 62 |
Post Options
Thanks(0)
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 !!
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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(); } |
|
unknow
Groupie Joined: 14 January 2009 Location: Belgium Status: Offline Points: 62 |
Post Options
Thanks(0)
|
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!
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |