PROBLEMS WITH RBUILDER AND PAGE BREAKS

edited March 2003 in General
OS: W2K
DELPHI: 5
RBUILDER: 5.54
OUTPUT: PREVIEW FORM AND PRINTER(GENERAL PROBLEM)

Hi!

I'm esperimenting a strange problem with rbuilder. My report's layout looks
something like:



-------------------------------------- PAGE HEADER
INVOICE NO
------------------------------------ GROUP1, PAGE HEADER (EMPTY)
------------------------------------ GROUP2, PAGE HEADER
ORDER NO...
------------------------------------ DETAIL BAND
QTY, PRICE..
------------------------------------ GROUP2, PAGE FOOTER (EMPTY)
------------------------------------ GROUP1, PAGE FOOTER
(including a subreport)
------------------------------------ PAGE FOOTER
OTHER 3 PAGES....
------------------------------------

This is my report's output. Other 2 particular events:

1. Report.OnStartPage:

if PageNo > 1 then HB.Height := 49 else HB.Height := 118;
if PageNo > 1 then FB.Height := 30 else FB.Height := 73;

I need these code because the layout of page 1 is quite different from
page 2 layout, so
I need different page footer and page header Heights values.

2. (THE PROBLEM) Group2.OnGetBreakValue:

GHGroup2.Visible := MyFunction();

I use this code because I need the label "ORDER NO..." to be hidden
sometimes.

ON 50% CASES THIS REPORT WORKS CORRECTLY, BUT ON REPORTS LONGER THAN 2
PAGES:

PAGE1

PGHEADER--
ORDER NO. 1
LINE 1..10 OK
ORDER NO. 2
LINE 11.20 OK
PGFOOTER--

PAGE2

PGHEADER-- (++SHORTER)
LINE 21..27(CONTINUING ORDER NO.2) OK
ORDER NO. 3
LINE 28..50 OK
PGFOOTER-- (++SHORTER)

PAGE3

PGHEADER-- (SAME AS PAGE2)
LINE 45..55 WRONG
ORDER NO. 4 OK
ETC...

SO IN PAGE 3 IT HAS REPEATED LINES 45, 46, 47, 48, 49, 50.

Trying to find a workaround at this problem, I removed the code that hides
the GroupHeder2 (ORDER NO...), and the report seems to
works correctly. However this cannot be my solution.

I hope you could help me find a good way to solve this problem.

Thank you.

Comments

  • edited March 2003
    Luca,

    Instead of setting the group's visibility in the GHGroup2.OnGetBreakValue
    event, try setting it in the GHGroup2.OnBeforePrint event. The
    OnGetBreakValue event is primarily used to set the break values of certian
    groups. This should fix your problem.


    Nico Cizik
    Digital Metaphors


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.