Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

Shifting up all components below a region if it's empty in code (not RAP)

edited May 2009 in End User
Hallo,

Please give me a hint how to shift up all components placed below a
region if the region is unvisible.

I know the method of placing them onto another region and setting its
ShiftRelativeTo to the first region. Unfortunately this does not work in
my case, since I allow my customers to edit the reports and am trying
to avoid a support overkill by explaining them all those components and
their relations.

I just need a code sample for doing this.
I've created my own TppRegion descendant class and was playing around
with SpaceUsed, Report.Engine.PrintPosRect etc, but did not succeed.

Thanks a lot in advance!

Kind Regard

Leo Kaploun

Comments

  • edited May 2009
    Hi Leo,

    Try creating a report object loop that finds all components below a certain
    measurement in the band (i.e. Region.Top) and moves them up.

    http://www.digital-metaphors.com:8080/Delphi_Code/Layouts/Report_Object_Loop

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2009
    Nico Cizik (Digital Metaphors) schrieb:
    Thanks Nico, I have already tried that too. The point is, that the
    visibility of my region varies in accordance to some condition.
    Therefore I'ld need to shift those components up and down. My reports
    are all double pass ones. I tryed to use BeforeGenerate event of the
    parent band for the shifting, but the second pass moved them back.

    Aren't any smarter way beside the component loop? What about SpaceUsed
    or PrintPosition, or maybe DrawCommand's issues?

    Thanks!

    Leo
  • edited May 2009
    Hi Leo,

    Another option that you might try is to ensure all components that are below
    the region are anchored to the bottom of the band. You can do this by
    altering the anchor property. This will ensure that the space between the
    component and the bottom of the band remains the same regardless the size of
    the region above.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2009
    Nico Cizik (Digital Metaphors) schrieb:

    Thanks again Nico!

    I have accomplished it using the component loop.

    Leo
This discussion has been closed.