Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Free memory

edited January 2002 in General
Hi,

What I would like to know is: if I create components (as dbText,
subreports, ...) dynamicaly, is it imperative to use a custom preview form?
Or, there is another form to free memory of these components?
And... I create components inside a subreport, if I destroy the subreport,
am I destroying the components too?
Thank you very much...

Bruno Nepomuceno

Comments

  • edited January 2002
    When you assign the component to a band, the report will take responsibility
    for freeing that component when the report is freed.

    If you do something like this, then the dbtext will get freed when the
    subreport is freed.
    ...
    lSubReport := TppSubReport.Create(Self);
    lSubReport.Band := aReport.Detail;
    lSubReport.CreateReport(aReport);
    lSubReport.Report.CreateDefaultBands;
    lSubReport.Report.DataPipeline := ppDBPipeline2;

    lDBText := TppDBText.Create(Self);
    lDBText.Band := TppBandedReport(lSubReport.Report).Detail;
    lDBText.Left := 0.1;
    lDBText.Top := 0.0313;
    lDBText.Width := 0.625;
    lDBText.DataPipeline := ppDBPipeline2;
    lDBText.DataField := 'OrderNo';
    lDBText.Transparent := True;
    lDBText.Font.Name := 'Arial';
    lDBText.Font.Size := 10;
    lDBText.Font.Style := [];


    {frees the dbText}
    lSubReport.Free;
    ...


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.