View Issue Details

IDProjectCategoryView StatusLast Update
0024305LazarusLazReportpublic2014-09-13 22:34
ReporterG. CollaAssigned ToJesus Reyes 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformAnyOSAnyOS Version
Product Version1.1 (SVN)Product BuildLazarus 1.1 r40858 
Target Version1.2.0Fixed in Version1.1 (SVN) 
Summary0024305: tfrBand.Name always return a null string
DescriptiontfrBand.Name is never set in LR_class unit. Therefore it's impossible to take advantage of OnBeginBand, OnEndBand, OnBeginColumn etc. events to obtain the Band name, which is always a null string.
Steps To ReproduceRunning the sample userds/project1 included in the LazReport directory with DEBUG enabled, one can verify that band name is never shown:
TForm1.frReport1BeginBand: Band=
Additional InformationtfrBand.Name cannot be set, because it shares the name with tfrBandView. Setting both tfrBandView.name and tfrBand.name would result in two objects with the same name, giving rise to a duplicate name error at design time, when setting tfrBand.Name.
But, as
1) the check for duplicate names is made only once when setting names
2) the tfrBand object has not yet been created when tfrBandView is created
a simple workaround is to define a Name property for tfrBand which just returns the corresponding tfrBandView name.

A patch to such effect is attached.
TagsNo tags attached.
Fixed in Revision40866
LazTarget1.2
Widgetset
Attached Files
  • lr_class.diff (870 bytes)
    Index: lr_class.pas
    ===================================================================
    --- lr_class.pas	(revisione 40858)
    +++ lr_class.pas	(copia locale)
    @@ -646,6 +646,7 @@
         procedure InitValues;
         procedure DoAggregate;
         procedure ResetLastValues;
    +    function getName: string;
       public
         maxdy: Integer;
     
    @@ -662,6 +663,7 @@
         constructor Create(ATyp: TfrBandType; AParent: TfrPage); overload;
         destructor Destroy; override;
         function IsDataBand: boolean;
    +    property Name: string read getName;
       end;
     
       TfrValue = class
    @@ -5222,6 +5224,13 @@
       result := (typ in [btMasterData, btDetailData, btSubDetailData]);
     end;
     
    +function TfrBand.getName: string;
    +begin
    +  if Assigned(View) then
    +    Result:= View.Name
    +  else Result:= '';
    +end;
    +
     procedure TfrBand.InitDataSet(const Desc: String);
     begin
       if Typ = btGroupHeader then
    
    lr_class.diff (870 bytes)

Activities

G. Colla

2013-04-21 19:33

developer  

lr_class.diff (870 bytes)
Index: lr_class.pas
===================================================================
--- lr_class.pas	(revisione 40858)
+++ lr_class.pas	(copia locale)
@@ -646,6 +646,7 @@
     procedure InitValues;
     procedure DoAggregate;
     procedure ResetLastValues;
+    function getName: string;
   public
     maxdy: Integer;
 
@@ -662,6 +663,7 @@
     constructor Create(ATyp: TfrBandType; AParent: TfrPage); overload;
     destructor Destroy; override;
     function IsDataBand: boolean;
+    property Name: string read getName;
   end;
 
   TfrValue = class
@@ -5222,6 +5224,13 @@
   result := (typ in [btMasterData, btDetailData, btSubDetailData]);
 end;
 
+function TfrBand.getName: string;
+begin
+  if Assigned(View) then
+    Result:= View.Name
+  else Result:= '';
+end;
+
 procedure TfrBand.InitDataSet(const Desc: String);
 begin
   if Typ = btGroupHeader then
lr_class.diff (870 bytes)

Jesus Reyes

2013-04-21 20:37

developer   ~0067063

Sorry, indeed I forgot to apply this patch in trunk after fixes branch was fixed.

Is now applied, thanks.

Issue History

Date Modified Username Field Change
2013-04-21 19:33 G. Colla New Issue
2013-04-21 19:33 G. Colla File Added: lr_class.diff
2013-04-21 20:18 Jesus Reyes Assigned To => Jesus Reyes
2013-04-21 20:18 Jesus Reyes Status new => assigned
2013-04-21 20:37 Jesus Reyes Fixed in Revision => 40866
2013-04-21 20:37 Jesus Reyes LazTarget => 1.2
2013-04-21 20:37 Jesus Reyes Note Added: 0067063
2013-04-21 20:37 Jesus Reyes Status assigned => resolved
2013-04-21 20:37 Jesus Reyes Fixed in Version => 1.1 (SVN)
2013-04-21 20:37 Jesus Reyes Resolution open => fixed
2013-04-21 20:37 Jesus Reyes Target Version => 1.2.0
2014-09-13 22:34 G. Colla Status resolved => closed