* Patch from Pascal Riekenberg: ApplyBandWidth: handle child bands like main parent band

git-svn-id: trunk@37481 -
This commit is contained in:
michael 2017-10-17 20:02:47 +00:00
parent af0fdea815
commit 2af27756da

View File

@ -841,6 +841,7 @@ type
TFPReportCustomBand = class(TFPReportElementWithChildren) TFPReportCustomBand = class(TFPReportElementWithChildren)
private private
FChildBand: TFPReportChildBand; FChildBand: TFPReportChildBand;
FParentBand: TFPReportCustomBand;
FKeepTogetherWithChildren: Boolean; FKeepTogetherWithChildren: Boolean;
FUseParentFont: boolean; FUseParentFont: boolean;
FVisibleOnPage: TFPReportVisibleOnPage; FVisibleOnPage: TFPReportVisibleOnPage;
@ -887,6 +888,7 @@ type
property VisibleOnPage: TFPReportVisibleOnPage read FVisibleOnPage write SetVisibleOnPage; property VisibleOnPage: TFPReportVisibleOnPage read FVisibleOnPage write SetVisibleOnPage;
function EvaluateVisibility: boolean; override; function EvaluateVisibility: boolean; override;
property ChildBand: TFPReportChildBand read FChildBand write SetChildBand; property ChildBand: TFPReportChildBand read FChildBand write SetChildBand;
property ParentBand: TFPReportCustomBand read FParentBand;
property Page : TFPReportCustomPage read GetReportPage; property Page : TFPReportCustomPage read GetReportPage;
end; end;
TFPReportCustomBandClass = Class of TFPReportCustomBand; TFPReportCustomBandClass = Class of TFPReportCustomBand;
@ -6673,12 +6675,21 @@ begin
end; end;
procedure TFPReportCustomPage.ApplyBandWidth(ABand: TFPReportCustomBand); procedure TFPReportCustomPage.ApplyBandWidth(ABand: TFPReportCustomBand);
var
lBand: TFPReportCustomBand;
begin begin
lBand := ABand;
if ABand is TFPReportCustomChildBand then
{ handle child bands like main parent band }
while Assigned(lBand.ParentBand) do
lBand := lBand.ParentBand;
{ set Band Width appropriately - certain bands are not affected by ColumnCount } { set Band Width appropriately - certain bands are not affected by ColumnCount }
if (ABand is TFPReportCustomTitleBand) if (lBand is TFPReportCustomTitleBand)
or (ABand is TFPReportCustomSummaryBand) or (lBand is TFPReportCustomSummaryBand)
or (ABand is TFPReportCustomPageHeaderBand) or (lBand is TFPReportCustomPageHeaderBand)
or (ABand is TFPReportCustomPageFooterBand) then or (lBand is TFPReportCustomPageFooterBand) then
ABand.Layout.Width := Layout.Width ABand.Layout.Width := Layout.Width
else else
ABand.Layout.Width := BandWidthFromColumnCount; ABand.Layout.Width := BandWidthFromColumnCount;
@ -7669,6 +7680,11 @@ begin
if b = self then if b = self then
raise EReportError.Create(SErrChildBandCircularReference); raise EReportError.Create(SErrChildBandCircularReference);
end; end;
if Assigned(FChildBand) then
begin
FChildBand.FParentBand := Self;
Page.ApplyBandWidth(FChildBand);
end;
end; end;
procedure TFPReportCustomBand.ApplyStretchMode; procedure TFPReportCustomBand.ApplyStretchMode;