TppRegion aligning alTop
Hi,
I've 3 regions:
ppRegion_If_True (Top=0)
ppRegion_If_False
ppRegion_Always
in my_ppReport.BeforePrint:
ppRegion_If_True.Visible := aCondition;
ppRegion_If_False.Visible := not aCondition;
If aCondition is False I would like to have printed ppRegion_If_False at
the place of not printed ppRegion_If_True.
If aCondition is True I would like to have printed ppRegion_Always
immediately after ppRegion_If_True.
If TppRegion would have a Align-property like TMemo, TPanel ... I'd set
all 3 regions.Align := alTop and the problem would be solved.
I've searched with tamarack for TppRegion & Align but the point me to
Stretch/StretchWithParent but it doesn't help.
My solution is to set in BeforePrint
ppRegion_If_True.Top := 0;
ppRegion_If_False.Top := 0;
ppRegion_Always.Top :=
ppRegion_If_True.Height * Ord(ppRegion_If_True.Visible)
+ ppRegion_If_False.Height * Ord(ppRegion_If_False.Visible);
What's the workaround with more elegance thru properties.
Best regards
Dietmar
I've 3 regions:
ppRegion_If_True (Top=0)
ppRegion_If_False
ppRegion_Always
in my_ppReport.BeforePrint:
ppRegion_If_True.Visible := aCondition;
ppRegion_If_False.Visible := not aCondition;
If aCondition is False I would like to have printed ppRegion_If_False at
the place of not printed ppRegion_If_True.
If aCondition is True I would like to have printed ppRegion_Always
immediately after ppRegion_If_True.
If TppRegion would have a Align-property like TMemo, TPanel ... I'd set
all 3 regions.Align := alTop and the problem would be solved.
I've searched with tamarack for TppRegion & Align but the point me to
Stretch/StretchWithParent but it doesn't help.
My solution is to set in BeforePrint
ppRegion_If_True.Top := 0;
ppRegion_If_False.Top := 0;
ppRegion_Always.Top :=
ppRegion_If_True.Height * Ord(ppRegion_If_True.Visible)
+ ppRegion_If_False.Height * Ord(ppRegion_If_False.Visible);
What's the workaround with more elegance thru properties.
Best regards
Dietmar
This discussion has been closed.
Comments
You should be able to accomplish this by placing one region on top of
another and toggling the visibility of each according to the condition.
This is possible by using the TppRegion.ShiftRelativeTo property. If you
set the second region to ShiftRelativeTo the first region, it will always
print below the first one.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I'd assumed that ShiftRelativeTo means that the old distance between the
"connected" printobjects remains.
But I've changed my source according to your suggestions and it seems
there is no space between my regions (on the design-form there is a space):
if aConditon
then ppRegion_Always.ShiftRelativeTo := ppRegion_If_True
else ppRegion_Always.ShiftRelativeTo := ppRegion_If_False;
ppRegion_If_True.Visible := aCondition;
ppRegion_If_False.Visible := not aCondition;
That does it.
Thanks
Dietmar
The ShiftRelativeTo property will not maintain the distance between objects
vertically. To ensure there is a given distance between object on a report,
you will need to use teh BottomOffset property.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com