` Printed Icetips Article

Icetips Article



ABC: Resizing report details
1998-06-22 -- Markku Niskanen
 
Newsgroups: topspeed.products.c4

Whew!

I did a hard job changing the report band dimensions
during runtime and this is how I did it. Anybody with
a more elegant solution please feel free to send your
comments here. The hardest things were:

a) Finding the correct embed point
b) Finding a way to hit the target band
c) Finding my cigarettes under the pile of test sheets.

First I gave the bands proper equate labels: ?Header1,
?Detail1 and ?Footer1 so that I could use them a bit later.
I also created global variables that I filled with the proper height
values from thi INI file. My report was written in millimeters and
the paper size was A4 (210x297mm) so this is where the '297'
comes from.

I used the ThisWindow.OpenReport Procedure and added
the following code right after the optional translations (comments
and extra material clipped):

ThisWindow.OpenReport PROCEDURE()

ReturnValue          BYTE,AUTO
  CODE
  ReturnValue = PARENT.OpenReport()
  IF ~ReturnValue
    Translator.TranslateWindow(SELF.Report)
  END
  ! [Priority 8800]
  ! This is where my code starts

    SetTarget(SELF.Report,?Header1)
    Report$?Header1{prop:height} = GLO:TopMargin

    SetTarget(SELF.Report,?Detail1)
    Report$?Detail1{prop:height} = GLO:LabelHeight

    Report$?Footer1{Prop:Ypos} = GLO:FooterY
    Report$?Footer1{Prop:Height} = 297 - Report$?Footer1{Prop:Ypos}

    SetTarget(SELF.Report)
    Target{prop:Ypos}     = GLO:TopMargin
    Target{prop:height}   = GLO:LabelsY * GLO:LabelHeight

    SetTarget ! Reset the target

There are two weird things. For some reason I had to Set SELF.Report
as the target LAST, otherwise the report height got a funny value from
one of the band heights set earlier.

The second funny thing is that this WORKED .

Markku



Printed November 24, 2024, 10:16 pm
This article has been viewed/printed 35348 times.
Google search has resulted in 12 hits on this article since January 25, 2004.