Creating components at runtime (in code)
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
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
This discussion has been closed.
Comments
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