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

Adding textfield to a region at runtime

edited July 2009 in General
I'm adding TppDBText components to a TppRegion at runtime like this:

----------------------------------------
lIDFieldRegion := TppRegion(FCurrentReport.DetailBand.FindUserObject('IDFieldsRegion'));
lTextField := TppDBText(ppComponentCreate(lIDFieldRegion, TppDBText));

//Adding properties of lTextField here
with lTextField do
begin
Left := lIDFieldRegion.Left + i * lTextFieldWidth;
Width := lTextFieldWidth - 1;
Top := lIDFieldRegion.Top;
Height := lIDFieldRegion.Height;
Font.Name := 'Arial';
Font.Size := 10;
DataPipeline := FPipeline;
DataField := 'Details.' + FCurrentIDFields.Selected.Items[i].FieldName;
end;
--------------------------------------

But this doesnt produce the field on the report.
What strikes me is that after the call to ppComponentCreate, the Parent property
of the new textfield is still nil, while I specify the region object as the
parent
Why is this?

Another thing that looks strange to me, is the fact that child objects of
i.e. a region, have absolute top and left properties, in stead of relative
to their parent. So if i move the region, aren't the objects inside the region
moved?


Greetings
Bas

Comments

This discussion has been closed.