While implementing an application which uses LazReport, trying to take advantage of OnBeginBand I discovered that Band.Name is never set and is left as an empty string. This can be annoying if you have more than one Band of the same type, so that Band.Typ is not enough to tell the right band. Here attached two patches which for me fixed the issue, one, an svn diff, for the svn version 2.4, and the other, a plain diff, for the current Lazarus release (1.0.4) version, i.e. 2.3.
Maybe it can be done much better, but just in case...

Giuliano

Index: lr_class.pas
===================================================================
--- lr_class.pas	(revisione 39655)
+++ lr_class.pas	(copia locale)
@@ -6237,6 +6237,7 @@
       x := bt.x; dx := bt.dx;
       InitDataSet(TfrBandView(bt).DataSet);
       View := bt;
+      Name:= bt.Name; // Get Band Name from BandView Name (G. Colla)
       Flags := bt.Flags;
       Visible := bt.Visible;
       bt.Parent := Bands[TfrBandView(bt).BandType];
@@ -6257,6 +6258,7 @@
            t.x := t.x - Bnd.x;
            t.Parent := Bnd;
            Bnd.Objects.Add(t);
+           Bnd.Name:= t.Name;  // Get Band Name from BandView Name (G. Colla)
          end;
       end;
     end;
@@ -6285,6 +6287,7 @@
         Bnd.y := bt.y;
         Bnd.dy := bt.dy;
         Bnd.View := bt;
+        Bnd.Name:= bt.Name;  // Get Band Name from BandView Name (G. Colla)
         Bnd.Flags := bt.Flags;
         Bnd.Visible := bt.Visible;
         bt.Parent := Bnd;
--- lr_class.pas.bak	2012-11-23 00:47:56.000000000 +0100
+++ lr_class.pas	2013-02-02 14:21:49.000000000 +0100
@@ -5996,6 +5996,7 @@
       x := bt.x; dx := bt.dx;
       InitDataSet(TfrBandView(bt).DataSet);
       View := bt;
+      Name:= bt.Name; // Get Band Name from BandView Name (G. Colla)
       Flags := bt.Flags;
       Visible := bt.Visible;
       bt.Parent := Bands[TfrBandView(bt).BandType];
@@ -6016,6 +6017,7 @@
            t.x := t.x - Bnd.x;
            t.Parent := Bnd;
            Bnd.Objects.Add(t);
+           Bnd.Name:= t.Name;  // Get Band Name from BandView Name (G. Colla)
          end;
       end;
     end;
@@ -6044,7 +6046,8 @@
         Bnd.y := bt.y;
         Bnd.dy := bt.dy;
         Bnd.View := bt;
-        Bnd.Flags := bt.Flags;
+	Bnd.Name:= bt.Name;  // Get Band Name from BandView Name (G. Colla)
+	Bnd.Flags := bt.Flags;
         Bnd.Visible := bt.Visible;
         bt.Parent := Bnd;
         with bt as TfrBandView, Bnd do
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to