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

Creating components at runtime (in code)

edited April 2002 in General
I can't seem to find any info on adding components at runtime.

I have a fairly basic report with header and detail bands, and I want to
dynamically add the ppLabel and ppDBText components in code.

The help doesnt seem to be helpful on the subject, and there doesnt seem to
be any demos on it.

Thanks for any help.

Dave Nottage

Comments

  • edited April 2002
    I wrote:

    I've figured it out by myself, and should have realised how, eg:

    function TDM.CreateReportControl(Index: integer;
    ControlClass: TppCustomTextClass; Band: TppBand): TppCustomText;
    begin
    Result := ControlClass.Create(Self);
    Result.Name := CtlName(ControlClass, Index);
    Result.Band := Band;
    Result.Top := RptControlTop;
    Result.Font.Name := RptControlFontName;
    Result.Font.Size := RptControlFontSize;
    end;

    The other properties are set elsewhere. The main points are that the module
    or form that the TppReport is on is what is passed as Self, and that the
    correct Band is assigned.

    --
    Dave Nottage
This discussion has been closed.