CXTPReportControl::GetReportAreaRows: wrong result |
Post Reply |
Author | |
leo_12
Groupie Joined: 12 April 2005 Location: Germany Status: Offline Points: 17 |
Post Options
Thanks(1)
Posted: 05 June 2012 at 8:18am |
Hi,
I have some trouble to get the best fit column width of the tree column in an virtual mode ReportControl. As documentation says, CXTPReportControl::GetReportAreaRows should return the number of currently visible rows between nStartRow and the bottom of the current view. In my case I have 2 rows in large view so they are all visible. The function returns 1. Should the nStartRow be included in the result or not? If not, then in CXTPReportControl::OnGetColumnDataBestFitWidth the result of GetReportAreaRows in the local variable nVisibleRows should be incremented by 1. Otherwise the width of the last item is not considered in the calculation of the width. |
|
Kind regards
Heiko Product: Xtreme ToolkitPro version 15.0.2 / 15.2.1.0423 Platform: Windows 7 64 Bit Language: C++ |
|
franji1
Groupie Joined: 28 June 2005 Status: Offline Points: 70 |
Post Options
Thanks(0)
|
(13.2.1) I just saw this behavior in my implementation of a "Best Fit All" on my virtual report control. If the last displayable row is the "widest" for a column, the Best Fit clips it (next "widest" is much narrower). If I scroll down so that another (yet narrower) row is in the viewport for the control, the "Best Fit All" works as expected!
11 years later - not too late I've been trying to fix it - thought it was in my code!
|
|
XTP 13.3
migrating to XTP 20.3 |
|
franji1
Groupie Joined: 28 June 2005 Status: Offline Points: 70 |
Post Options
Thanks(0)
|
I just saw that CXTPReportControl::OnGetItemsCaptionMaxWidth is virtual. I can override it and fix it that way.
EDIT 13.3 int CXTPReportControl::GetReportAreaRows(int nStartRow, BOOL bMoveDown) { ... //return bMoveDown ? m_pRows->GetCount() - nStartRow : nStartRow; return bMoveDown ? m_pRows->GetCount() - nStartRow - 1: nStartRow; //-this is better way! } The code looks WRONG. It does all this work to determine what is the last row (in the local var i), yet the return statement does not take into account any of that work (the commented out return is theirs). There should be an i in the return statement somewhere???
|
|
XTP 13.3
migrating to XTP 20.3 |
|
franji1
Groupie Joined: 28 June 2005 Status: Offline Points: 70 |
Post Options
Thanks(0)
|
The code (GetReportAreaRows) appears to still be busted in 20.x
Maybe I do not understand what this method is supposed to do (why all that work without doing anything with it?)
|
|
XTP 13.3
migrating to XTP 20.3 |
|
franji1
Groupie Joined: 28 June 2005 Status: Offline Points: 70 |
Post Options
Thanks(0)
|
I "overrode" OnGetItemsCaptionMaxWidth
int CMemViewReportCtrl::OnGetItemsCaptionMaxWidth(CDC* pDC, CXTPReportRows* pRows, CXTPReportColumn* pColumn, int nStartRow /* = 0 */, int nRowsCount /* = -1 */)
|
|
XTP 13.3
migrating to XTP 20.3 |
|
franji1
Groupie Joined: 28 June 2005 Status: Offline Points: 70 |
Post Options
Thanks(0)
|
FYI to duplicate the bug in GetReportAreaRows() (or the bug could be in OnGetItemsCaptionMaxWidth, depending upon if GetReportAreaRows() behavior is actually "correct"),
stick the widest data (by far) in the last row of your RC in one of the columns.
View your RC with the last row NOT visible. It may only be an issue in virtual mode (the |
|
XTP 13.3
migrating to XTP 20.3 |
|
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 |