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

OnBeforePrint positioning components

edited June 2002 in General
Hello, I was the one trying to keep 3 regions grouped on the same page and
since it's
not possible I redid the report with all components placed directly on the
detail band
of a subreport. Because of this I'm obliged to manually position most
components before it prints,
the problem is that the text of some memos is added in the onbeforeprint
event, before
being placed, and after doing that the height property does not change (they
still strech correctly).
I need their new height for positionning the other components...
Why won't the height update correctly, is there a way to force them to
update?
Or is there a better way or moment for adding text and positionning them?
Oh it's on report builder 5.56 and Delphi 5.
Thanks.

Comments

  • edited June 2002
    Why don't you simply use the ShiftRelativeTo property of the memos to have
    them automatically position themselves in relation to each other instead of
    manually getting the height and positioning them.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited June 2002
    The memos have to be aligned under different components depending on the
    situation,
    because some labels can be invisible or not, etc... So you don't know in
    advance.
    Setting shiftrelativeto in onbeforeprint didnt seem to work, at least when I
    tried
    setting it in design mode and then setting it to nil in onbeforeprint, then
    moving it
    using the Top property it didnt move and stayed under it's shiftrelativeto
    object.

    Here's some example, I hope the layout is readable, font arial 9.
    The 4 things on the right are labels, each can be visible or not,
    memo1 can contain any nb of lines, same with memo2. So in onbeforeprint I
    just find
    out if I align memo2 under one of the labels or memo1, depending which
    labels are
    visible and the vertical size of memo1. I don't know if changing
    shiftrelativeto in
    onbeforeprint is supposed to update the report but it didnt. And it's not
    only that
    but the fact that memo1's text is also set at this time and I can't get it's
    new height
    correctly. Why wouldnt this work anyway, it's quite simple.

    ---------------------- =======
    - memo1 =======
    ---------------------- =========
    =========
    ----------------------------------------
    - memo2
    ----------------------------------------
    line-> --------------------------------------------



    "Alexander Kramnik (Digital Metaphors)" wrote
  • edited June 2002
    I created an example which switcher the ShiftRelativeTo of Memo 2 from Memo
    1 to the labels at runtime. This worked. I did have to put the labels in a
    region. In order to keep all the content together, as I believe your
    requirment was, I created a group on a field that is guaranteed to change
    for every record and set the group to KeepTogether. I emailed you the saved
    template with the layout so hopefully this should help you create your
    report.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited June 2002
    Thanks a lot, I used a similar layout and it worked.


    "Alexander Kramnik (Digital Metaphors)" wrote
This discussion has been closed.