View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0030466 | Packages | LazReport | public | 2016-08-12 11:40 | 2017-09-14 20:43 |
Reporter | Lutz Mändle | Assigned To | Jesus Reyes | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 1.6 | ||||
Target Version | 1.8 | Fixed in Version | 1.9 (SVN) | ||
Summary | 0030466: Child bands can became orphans | ||||
Description | If a child-band is used, it can be printed on the next page independent from its parent band. The attached patch avoids this. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 55861 | ||||
LazTarget | 1.8 | ||||
Widgetset | GTK 2 | ||||
Attached Files |
|
|
lr_class.patch (395 bytes)
--- ./orig/lr_class.pas 2015-09-09 21:19:14.000000000 +0200 +++ ./patched/lr_class.pas 2016-08-12 00:30:50.000000000 +0200 @@ -7099,6 +7099,12 @@ CalculatedHeight := dy; if Stretched then Result := CalcHeight; end; + b := Self.ChildBand; + while Assigned(b) do + begin + Result := Result + b.CalcHeight; + b := b.ChildBand; + end; end; function TfrBand.Draw: Boolean; |
|
If I understand you correctly, I don't see anything wrong with the current behaviour. The preferred solution might be to implement a ChildBand.StayWithParent (or some better name) property, so the behaviour can be controlled by the developer. Maybe they want everything to stay together, maybe they don't mind wrapping. Just a thought. |
|
I introduced a KeepChild property for the parent band, which allows to control whether the child band can go to the next page or not. The attached patch is complete, it contains all needed changes to lr_class.pas, lr_const.pas and the language files. I've updated only the default and the german language file. |
|
lazreport.patch (3,519 bytes)
diff -Naur ./orig/lazreport/source/languages/lr_const.de.po ./patched/lazreport/source/languages/lr_const.de.po --- ./orig/lazreport/source/languages/lr_const.de.po 2015-06-16 10:58:34.000000000 +0200 +++ ./patched/lazreport/source/languages/lr_const.de.po 2016-08-17 21:18:12.000000000 +0200 @@ -1523,6 +1523,10 @@ msgid "Keep aspect ratio" msgstr "Seitenverhältnis beibehalten" +#: lr_const.skeepchild +msgid "Keep child together with parent" +msgstr "Nachfolger zusammen mit Elternband drucken" + #: lr_const.slazformfile msgid "LazReport form" msgstr "LazReport-Formular" diff -Naur ./orig/lazreport/source/languages/lr_const.po ./patched/lazreport/source/languages/lr_const.po --- ./orig/lazreport/source/languages/lr_const.po 2015-01-22 22:36:41.000000000 +0100 +++ ./patched/lazreport/source/languages/lr_const.po 2016-08-17 21:18:24.000000000 +0200 @@ -1508,6 +1508,10 @@ msgid "Keep aspect ratio" msgstr "" +#: lr_const.skeepchild +msgid "Keep child together with parent" +msgstr "" + #: lr_const.slazformfile msgid "LazReport form" msgstr "" diff -Naur ./orig/lazreport/source/lr_class.pas ./patched/lazreport/source/lr_class.pas --- ./orig/lazreport/source/lr_class.pas 2015-09-09 21:19:14.000000000 +0200 +++ ./patched/lazreport/source/lr_class.pas 2016-08-17 21:37:25.000000000 +0200 @@ -47,6 +47,7 @@ flBandOnLastPage = $20; flBandRepeatHeader = $40; flBandPrintChildIfNotVisible = $80; + flBandKeepChild = $100; flPictCenter = 2; flPictRatio = 4; @@ -567,6 +568,7 @@ procedure P5Click(Sender: TObject); procedure P6Click(Sender: TObject); procedure P7Click(Sender: TObject); + procedure P8Click(Sender: TObject); function GetTitleRect: TRect; function TitleSize: Integer; procedure CalcTitleSize; @@ -5336,6 +5338,15 @@ m.Checked := (Flags and flBandPrintChildIfNotVisible) <> 0; Popup.Items.Add(m); end; + + if not (BandType in [btChild, btPageFooter]) then + begin + m := TMenuItem.Create(Popup); + m.Caption := sKeepChild; + m.OnClick := @P8Click; + m.Checked := (Flags and flBandKeepChild) <> 0; + Popup.Items.Add(m); + end; end; procedure TfrBandView.P1Click(Sender: TObject); @@ -5434,6 +5445,16 @@ end; end; +procedure TfrBandView.P8Click(Sender: TObject); +begin + frDesigner.BeforeChange; + with Sender as TMenuItem do + begin + Checked := not Checked; + Flags := (Flags and not flBandKeepChild) + Word(Checked) * flBandKeepChild; + end; +end; + function TfrBandView.GetTitleRect: TRect; begin if BandType in [btCrossHeader..btCrossFooter] then @@ -7099,6 +7120,15 @@ CalculatedHeight := dy; if Stretched then Result := CalcHeight; end; + if (Flags and flBandKeepChild) <> 0 then + begin + b := Self.ChildBand; + while Assigned(b) do + begin + Result := Result + b.CalcHeight; + b := b.ChildBand; + end; + end; end; function TfrBand.Draw: Boolean; diff -Naur ./orig/lazreport/source/lr_const.pas ./patched/lazreport/source/lr_const.pas --- ./orig/lazreport/source/lr_const.pas 2015-01-22 22:36:41.000000000 +0100 +++ ./patched/lazreport/source/lr_const.pas 2016-08-17 21:21:01.000000000 +0200 @@ -226,6 +226,7 @@ sPrintIfSubsetEmpty = 'Print if detail empty'; sPrintChildIfNotVisible = 'Print child if not visible'; sBreaked = 'Breaked'; + sKeepChild = 'Keep child together with parent'; sPictureCenter = 'Center picture'; sKeepAspectRatio = 'Keep aspect ratio'; |
|
I modified the patch to match the version of lazreport from Lazarus 1.6.2. The attached file supersedes the the file from 2016-08-17. |
|
lazreport_update1.patch (3,520 bytes)
diff -Naur ./orig/lazreport/source/languages/lr_const.de.po ./patched/lazreport/source/languages/lr_const.de.po --- ./orig/lazreport/source/languages/lr_const.de.po 2016-06-09 00:43:10.000000000 +0200 +++ ./patched/lazreport/source/languages/lr_const.de.po 2016-11-25 15:40:07.000000000 +0100 @@ -1523,6 +1523,10 @@ msgid "Keep aspect ratio" msgstr "Seitenverhältnis beibehalten" +#: lr_const.skeepchild +msgid "Keep child together with parent" +msgstr "Nachfolger zusammen mit Elternband drucken" + #: lr_const.slazformfile msgid "LazReport form" msgstr "LazReport-Formular" diff -Naur ./orig/lazreport/source/languages/lr_const.po ./patched/lazreport/source/languages/lr_const.po --- ./orig/lazreport/source/languages/lr_const.po 2015-01-22 22:36:41.000000000 +0100 +++ ./patched/lazreport/source/languages/lr_const.po 2016-11-25 15:40:07.000000000 +0100 @@ -1508,6 +1508,10 @@ msgid "Keep aspect ratio" msgstr "" +#: lr_const.skeepchild +msgid "Keep child together with parent" +msgstr "" + #: lr_const.slazformfile msgid "LazReport form" msgstr "" diff -Naur ./orig/lazreport/source/lr_class.pas ./patched/lazreport/source/lr_class.pas --- ./orig/lazreport/source/lr_class.pas 2016-04-14 00:39:02.000000000 +0200 +++ ./patched/lazreport/source/lr_class.pas 2016-11-25 15:47:32.000000000 +0100 @@ -47,6 +47,7 @@ flBandOnLastPage = $20; flBandRepeatHeader = $40; flBandPrintChildIfNotVisible = $100; + flBandKeepChild = $200; flPictCenter = 2; flPictRatio = 4; @@ -567,6 +568,7 @@ procedure P5Click(Sender: TObject); procedure P6Click(Sender: TObject); procedure P7Click(Sender: TObject); + procedure P8Click(Sender: TObject); function GetTitleRect: TRect; function TitleSize: Integer; procedure CalcTitleSize; @@ -5340,6 +5342,15 @@ m.Checked := (Flags and flBandPrintChildIfNotVisible) <> 0; Popup.Items.Add(m); end; + + if not (BandType in [btChild, btPageFooter]) then + begin + m := TMenuItem.Create(Popup); + m.Caption := sKeepChild; + m.OnClick := @P8Click; + m.Checked := (Flags and flBandKeepChild) <> 0; + Popup.Items.Add(m); + end; end; procedure TfrBandView.P1Click(Sender: TObject); @@ -5438,6 +5449,16 @@ end; end; +procedure TfrBandView.P8Click(Sender: TObject); +begin + frDesigner.BeforeChange; + with Sender as TMenuItem do + begin + Checked := not Checked; + Flags := (Flags and not flBandKeepChild) + Word(Checked) * flBandKeepChild; + end; +end; + function TfrBandView.GetTitleRect: TRect; begin if BandType in [btCrossHeader..btCrossFooter] then @@ -7113,6 +7134,15 @@ CalculatedHeight := dy; if Stretched then Result := CalcHeight; end; + if (Flags and flBandKeepChild) <> 0 then + begin + b := Self.ChildBand; + while Assigned(b) do + begin + Result := Result + b.CalcHeight; + b := b.ChildBand; + end; + end; end; function TfrBand.Draw: Boolean; diff -Naur ./orig/lazreport/source/lr_const.pas ./patched/lazreport/source/lr_const.pas --- ./orig/lazreport/source/lr_const.pas 2015-01-22 22:36:41.000000000 +0100 +++ ./patched/lazreport/source/lr_const.pas 2016-11-25 15:40:07.000000000 +0100 @@ -226,6 +226,7 @@ sPrintIfSubsetEmpty = 'Print if detail empty'; sPrintChildIfNotVisible = 'Print child if not visible'; sBreaked = 'Breaked'; + sKeepChild = 'Keep child together with parent'; sPictureCenter = 'Center picture'; sKeepAspectRatio = 'Keep aspect ratio'; |
|
Applied, thanks. |
Date Modified | Username | Field | Change |
---|---|---|---|
2016-08-12 11:40 | Lutz Mändle | New Issue | |
2016-08-12 11:40 | Lutz Mändle | File Added: lr_class.patch | |
2016-08-12 13:16 | Graeme Geldenhuys | Note Added: 0094104 | |
2016-08-17 22:00 | Lutz Mändle | Note Added: 0094163 | |
2016-08-17 22:00 | Lutz Mändle | File Added: lazreport.patch | |
2016-08-25 21:23 | Jesus Reyes | Assigned To | => Jesus Reyes |
2016-08-25 21:23 | Jesus Reyes | Status | new => assigned |
2016-12-01 23:54 | Lutz Mändle | Note Added: 0096456 | |
2016-12-01 23:56 | Lutz Mändle | File Added: lazreport_update1.patch | |
2017-09-14 20:43 | Jesus Reyes | Fixed in Revision | => 55861 |
2017-09-14 20:43 | Jesus Reyes | LazTarget | => 1.8 |
2017-09-14 20:43 | Jesus Reyes | Widgetset | => GTK 2 |
2017-09-14 20:43 | Jesus Reyes | Note Added: 0102842 | |
2017-09-14 20:43 | Jesus Reyes | Status | assigned => resolved |
2017-09-14 20:43 | Jesus Reyes | Fixed in Version | => 1.9 (SVN) |
2017-09-14 20:43 | Jesus Reyes | Resolution | open => fixed |
2017-09-14 20:43 | Jesus Reyes | Target Version | => 1.8 |