From f327ba8d5206a072e2fb388028d3bc4e6003fdba Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 5 Mar 2018 13:01:16 +0000 Subject: [PATCH] * Child band can be used only for one parent band (bug ID #33284) git-svn-id: trunk@57448 - --- components/fpreport/design/regfpdesigner.pp | 47 +++++++++++++++++---- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/components/fpreport/design/regfpdesigner.pp b/components/fpreport/design/regfpdesigner.pp index c9a506ac00..aebf53678f 100644 --- a/components/fpreport/design/regfpdesigner.pp +++ b/components/fpreport/design/regfpdesigner.pp @@ -73,6 +73,8 @@ Type { TReportBandPropertyEditor } TReportBandPropertyEditor = class(TReportComponentPropertyEditor) + protected + function BandAllowed(B: TFPReportCustomBand): Boolean; virtual; Public Function BandTypes : TFPReportBandTypes; virtual; procedure GetValues(Proc: TGetStrProc); override; @@ -83,6 +85,7 @@ Type TChildBandPropertyEditor = Class(TReportBandPropertyEditor) Public + function BandAllowed(B: TFPReportCustomBand): Boolean; override; Function BandTypes : TFPReportBandTypes; override; end; @@ -281,6 +284,29 @@ end; { TChildBandPropertyEditor } +function TChildBandPropertyEditor.BandAllowed(B: TFPReportCustomBand): Boolean; + +Var + P : TFPReportCustomPage; + CB : TFPReportCustomBand; + I : Integer; + +begin + Result:=inherited BandAllowed(B); + CB:=TFPReportCustomBand(GetComponent(0)); + If Result then + begin + P:=GetPage; + I:=P.BandCount-1; + While Result and (I>=0) do + begin + Result:=(P.Bands[i]=CB) or (P.Bands[i].ChildBand<>B); + Dec(I) + end; + + end; +end; + function TChildBandPropertyEditor.BandTypes: TFPReportBandTypes; begin Result:=[btChild]; @@ -293,24 +319,27 @@ begin Result:=[] end; +Function TReportBandPropertyEditor.BandAllowed(B : TFPReportCustomBand) : Boolean; + +Var + BT : TFPReportBandTypes; + +begin + BT:=BandTypes; + Result:=(B.Name<>'') and (B<>GetComponent(0)); + if Result and (BT<>[]) then + Result:=B.ReportBandType in BT; +end; + procedure TReportBandPropertyEditor.GetValues(Proc: TGetStrProc); Var P : TFPReportCustomPage; I : Integer; - BT : TFPReportBandTypes; - Function BandAllowed(B : TFPReportCustomBand) : Boolean; - - begin - Result:=(B.Name<>'') and (B<>GetComponent(0)); - if Result and (BT<>[]) then - Result:=B.ReportBandType in BT; - end; begin P:=GetPage; - BT:=BandTypes; proc(oisNone); if Assigned(P) then For I:=0 to P.BandCount-1 do