Possible TReport problem with ::NeedNewPage()

Post Reply
User avatar
Roger Seiler
Posts: 223
Joined: Thu Dec 01, 2005 3:34 pm
Location: Nyack, New York, USA
Contact:

Possible TReport problem with ::NeedNewPage()

Post by Roger Seiler »

Antonio,

I had a problem with occasionally getting a blank page printed out between other normal pages. So I took a close look at the way ::NeedNewPage() is implemented in TReport and found that ::nStdLineHeight gets added twice in immediate succession to ::nRow, and this seemed to be the source of my problem. Apparently it should have only been added once.

Here is how it happens...

1. In ::EndLine()...

DEFAULT nHeight := ::nStdLineHeight

::nRow += nHeight

IF ::NeedNewPage()
::EndPage()
ENDIF

2. In the definition of ::NeedNewPage()...

METHOD NeedNewPage INLINE ( ::nRow + ::nStdLineHeight >= ::nBottomRow )

Isn't the addition of ::nStdLineHeight in this method an unnecessary duplication of the addition of this same value immediately prior in ::EndLine() ?

Adding this value a second time sometimes pushes the value of ::nRow to a number greater than ::nBottomRow, even though the bottom of the page has actually not quite yet been reached, thereby forcing an ::EndPage() before it is actually needed.

- Roger
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Possible TReport problem with ::NeedNewPage()

Post by Enrico Maria Giordano »

I agree. I always used

Code: Select all

METHOD NeedNewPage() INLINE ( ::nRow >= ::nBottomRow )
in my customized TReport.

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Roger,

>
Isn't the addition of ::nStdLineHeight in this method an unnecessary duplication of the addition of this same value immediately prior in ::EndLine() ?
>

Yes, it looks so. Is it working fine now with your fix ?

Thanks for your feedback,
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Roger Seiler
Posts: 223
Joined: Thu Dec 01, 2005 3:34 pm
Location: Nyack, New York, USA
Contact:

Post by Roger Seiler »

Yes, Enrico's fix works fine. Thanks.

- Roger
Post Reply