Inherited x Fr 3.15

srxsrx
edited 11:09AM in FastReport 3.0
Ps: Translated by GlobalLink

Dear Support

I am testing Fast Report 3.15 and Delphi 7 and I am working with standardization of the screens through inheritance and when trying to do this with Fr he/she gave it is error message in the form son to access Edit Report: CANNOT RENAME COMPONENT FRXREPORT1, COMPONENT WAS INTRODUCED AN ANCESTOR FORM


" MAIN FORM "
unit Unit1;

interface

use
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;

type
TForm1 = class(TForm)
frxReport1: TfrxReport;
private
{Private declarations}
public
{Public declarations}
end;

var
Form1: TForm1;

implementation

{$R * .DFM}

end.

DFM "
object Form1: TForm1
Left = 329
Top = 108
Width = 870
Height = 500
Caption = ' Form1 '
Color = clBtnFace
FONT.CHARSET = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
FONT.NAME = ' BAD SANS SERIF'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 101
TextHeight = 13
object frxReport1: TfrxReport
Version = ' 3.15 '
DotMatrixReport = False
IniFile = ' \Software\Fast Reports'
PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator]
PreviewOptions.Zoom = 1.000000000000000000
PrintOptions.Printer = ' Padr??o'
ReportOptions.CreateDate = 38677.499302835650000000
ReportOptions.LastChange = 38677.499302835650000000
ScriptLanguage = ' PascalScript'
ScriptText.Strings = (
' begin'
''
' end. ')
Left = 136
Top = 72
Datasets = <>
Variables = <>
Style = <>
end
end



" FORM INHERITED "
unit Unit2;

interface

use
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Unit1, frxClass;

type
TForm2 = class(TForm1)
private
{Private declarations}
public
{Public declarations}
end;

var
Form2: TForm2;

implementation

{$R * .DFM}

end.


DFM "
inherited Form2: TForm2
Caption = ' Form2 '
PixelsPerInch = 101
TextHeight = 13
inherited frxReport1: TfrxReport
Datasets = <>
Variables = <>
Style = <>
end
end

Comments

  • edited 11:09AM
    Hello

    I have the same problem. I did a probe with inherited cmponent too, but after I create some controls in the report component (bands and labels in some fashion I need) I can`t assign the names to these controls. I don`t receive errors when compiling or installing the inherited component, but when I invoke the designer I receive a message about "already exists a object with this name o somethnig like this" .

    This is my "code".

    ...

    TMyRep = class(TfrxReport)
    private
    { Private declarations }
    public
    { Public declarations }
    constructor Create(aOwner: TComponent); override;
    published
    end;


    implementation

    constructor TMyRep.Create(aOwner: TComponent);
    var
    //_DM : TDataModule;
    //_Cfg : TADODataSet;
    Page: TfrxReportPage;
    BandaEnc, BandaPie: TfrxBand;
    DataBand: TfrxMasterData;
    MemoComp1: TfrxMemoView;
    Begin
    inherited Create(aOwner);
    { add a page }
    Page := TfrxReportPage.Create(Self);
    { create a unique name }
    Page.CreateUniqueName;
    //Page.Name := 'Pag1'; // .CreateUniqueName;
    { set sizes of fields, paper and orientation by default }
    Page.SetDefaults;
    { modify paper???s orientation }
    Page.Orientation := poPortrait;
    { add a report title band}
    BandaEnc := TfrxPageHeader.Create(Page);
    //BandaEnc.CreateUniqueName;
    { it is sufficient to set the ?«Top?» coordinate and height for a band }
    { both coordinates are in pixels }
    BandaEnc.Top := 0;
    BandaEnc.Height := 115;
    { Objeto Competencia }
    MemoComp1 := TfrxMemoView.Create(BandaEnc);
    //MemoComp1.CreateUniqueName;// 'TitCompetencia';
    MemoComp1.Text := 'Competencia';
    MemoComp1.Top := 0; MemoComp1.Font.Size := 12;
    MemoComp1.Height := 20;
    MemoComp1.Align := baWidth;
    MemoComp1.HAlign := haCenter;
    MemoComp1.Frame.Typ := [ftLeft, ftTop, ftRight];
    .....

    end;
  • edited 11:09AM
    Hello

    I think I forgot something. Now I repeated the mentioned process and I could remember.

    I could assign names to reports`s bands, labels, etc and the designer showed all right, I could do preview (in design mode), but I can not compile. I receive the error:

    Exception Exception in module .... at ......
    prDupl


    What is this? Help, please.

    lmir

    Thanks in advancve
  • edited 11:09AM
    frxReport CAN NOT be inherited !

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.