Print Page | Close Window

CXTPReportControl::GetReportAreaRows: wrong result

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=19839
Printed Date: 14 May 2024 at 3:52am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPReportControl::GetReportAreaRows: wrong result
Posted By: leo_12
Subject: CXTPReportControl::GetReportAreaRows: wrong result
Date 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++



Replies:
Posted By: franji1
Date Posted: 25 October 2023 at 10:01am
(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 Handshake

I've been trying to fix it - thought it was in my code!


-------------
XTP 13.3
migrating to XTP 20.3


Posted By: franji1
Date Posted: 25 October 2023 at 10:34am
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


Posted By: franji1
Date Posted: 25 October 2023 at 10:55am
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


Posted By: franji1
Date Posted: 25 October 2023 at 11:22am
I "overrode" OnGetItemsCaptionMaxWidth

int CMemViewReportCtrl::OnGetItemsCaptionMaxWidth(CDC* pDC, CXTPReportRows* pRows, CXTPReportColumn* pColumn, int nStartRow /* = 0 */, int nRowsCount /* = -1 */)
{
// OBOB in XTP in reporting # of visible rows (in virtual mode???)
if ((nRowsCount >= 0) /* && IsVirtualMode()*/ && (nStartRow >= 0))
{
// if I have 10 rows 0..9, the row count is still 10, not 9!
if (nRowsCount == (GetRows()->GetCount() - nStartRow - 1))
{
//HASSERT(false);
nRowsCount++;
}
}
const int nWidth = BASE_CLASS::OnGetItemsCaptionMaxWidth(pDC, pRows, pColumn, nStartRow, nRowsCount);
return nWidth;
}



-------------
XTP 13.3
migrating to XTP 20.3


Posted By: franji1
Date Posted: 25 October 2023 at 11:31am
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.  Resize Autosize the column, and it works correctly.  Scroll down so that this last row is visible.  Resize  Autosize that column again and it does not take into account the width of that last row.

It may only be an issue in virtual mode (the resize  autosize behavior, not the GetReportAreaRows issue)


-------------
XTP 13.3
migrating to XTP 20.3



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