浏览代码

* Adjust smMaxheight so it also applies when the band height changes.

git-svn-id: trunk@38923 -
michael 7 年之前
父节点
当前提交
b169e1bfc3
共有 1 个文件被更改,包括 25 次插入3 次删除
  1. 25 3
      packages/fcl-report/src/fpreport.pp

+ 25 - 3
packages/fcl-report/src/fpreport.pp

@@ -689,7 +689,7 @@ type
     procedure SetVisibleExpr(AValue: String);
   protected
     Procedure ParentFontChanged; virtual;
-    procedure ApplyStretchMode(const ADesiredHeight: TFPReportUnits);
+    procedure ApplyStretchMode(const ADesiredHeight: TFPReportUnits); virtual;
     function GetDateTimeFormat: String; virtual;
     function ExpandMacro(const s: String; const AIsExpr: boolean): TFPReportString; virtual;
     function GetReportBand: TFPReportCustomBand; virtual;
@@ -757,6 +757,7 @@ type
     procedure PrepareObjects(aRTParent: TFPReportElement); virtual;
     { This should run against the runtime version of the children }
     procedure RecalcLayout; override;
+    procedure ApplyStretchMode(const ADesiredHeight: TFPReportUnits);override;
   public
     destructor  Destroy; override;
     Procedure   Validate(aErrors : TStrings); override;
@@ -4409,8 +4410,10 @@ end;
 { package the text into TextBlock objects. We don't apply Memo Margins here - that
   gets done in the Apply*TextAlignment() methods. }
 procedure TFPReportCustomMemo.PrepareTextBlocks;
+
 var
   i: integer;
+
 begin
   { blockstate is cleared outside the FOR loop because the font state could
     roll over to multiple lines. }
@@ -4419,13 +4422,11 @@ begin
   FLastURL := '';
   FLastFGColor := clNone;
   FLastBGColor := clNone;
-
   for i := 0 to FTextLines.Count-1 do
   begin
     FTextBlockXOffset := 0;
     if Assigned(FCurTextBlock) then
       FTextBlockYOffset := FTextBlockYOffset + FCurTextBlock.Height + FCurTextBlock.Descender + LineSpacing;
-
     if moAllowHTML in Options then
     begin
       FParser := THTMLParser.Create(FTextLines[i]);
@@ -7292,6 +7293,27 @@ begin
       Child[i].RecalcLayout;
 end;
 
+procedure TFPReportElementWithChildren.ApplyStretchMode(const ADesiredHeight: TFPReportUnits);
+
+var
+   OldH,H: TFPReportUnits;
+   i: Integer;
+   c: TFPReportElement;
+
+begin
+  OldH:=RTLayout.Height;
+  inherited ApplyStretchMode(ADesiredHeight);
+  H:=RTLayout.Height;
+  // If the height changed, recalc for smMaxheight.
+  if (H<>OldH) then
+    for i := 0 to ChildCount-1 do
+      begin
+      c := Child[i];
+      if (c.StretchMode = smMaxHeight) then
+        C.RecalcLayout;
+      end;
+end;
+
 destructor TFPReportElementWithChildren.Destroy;
 var
   i: integer;