Creating components runtime
Hello I am trying to create a memo and a shape component runtime... but I
have problem becouse streching the memo it draws itself over the bottom side
of a rectagular shape instead to be printed inside. I am posting my code
maybe I wrong somewhere...
Cheers
Marco
APosY:= 0;
APosX:=0;
iOffSet:= 2;
aWidth:= 150;
ChrW:= 5;
aBand:= >> point to detail band and its heght is dynamic.
AMargin:= 10;
iCompIndex := FListaComp.Add(TppShape.Create(self));
//draw the shape
with TppShape(FListaComp.Items[iCompIndex]) do
begin
Pen.Width := 1;
Shape := stRectangle;
Name := 'grdDetShp' + aField;
StretchWithParent := true;
spWidth := aWidth + chrW;
Band := aBand;
spLeft := AMargin + aPosx;
spTop := aPosY;
SendToBack;
end;
//draw the memo
iCompIndex := FListaComp.Add(TppDBMemo.Create(self));
with TppDBMemo(FListaComp.Items[iCompIndex]) do
begin
CharWrap:= true;
KeepTogether := true;
TextAlignment := taLeftJustified;
Stretch := true;
Name := 'grddb' + aField;
DataPipeline := AReport.DataPipeline;
DataField := aField;
Font.Assign(aFont);
spWidth := 150 - (iOffSet * 2);
Band := aBand;
spLeft := AMargin + iOffSet + aPosx;
spTop := aPosY + iOffSet;
end;
end;
have problem becouse streching the memo it draws itself over the bottom side
of a rectagular shape instead to be printed inside. I am posting my code
maybe I wrong somewhere...
Cheers
Marco
APosY:= 0;
APosX:=0;
iOffSet:= 2;
aWidth:= 150;
ChrW:= 5;
aBand:= >> point to detail band and its heght is dynamic.
AMargin:= 10;
iCompIndex := FListaComp.Add(TppShape.Create(self));
//draw the shape
with TppShape(FListaComp.Items[iCompIndex]) do
begin
Pen.Width := 1;
Shape := stRectangle;
Name := 'grdDetShp' + aField;
StretchWithParent := true;
spWidth := aWidth + chrW;
Band := aBand;
spLeft := AMargin + aPosx;
spTop := aPosY;
SendToBack;
end;
//draw the memo
iCompIndex := FListaComp.Add(TppDBMemo.Create(self));
with TppDBMemo(FListaComp.Items[iCompIndex]) do
begin
CharWrap:= true;
KeepTogether := true;
TextAlignment := taLeftJustified;
Stretch := true;
Name := 'grddb' + aField;
DataPipeline := AReport.DataPipeline;
DataField := aField;
Font.Assign(aFont);
spWidth := 150 - (iOffSet * 2);
Band := aBand;
spLeft := AMargin + iOffSet + aPosx;
spTop := aPosY + iOffSet;
end;
end;
This discussion has been closed.
Comments
Your code looks fine. Is the memo printing outside the rectangle when you
print to your printer or just to the screen. As a test, try zooming in to
250% in your preview window and see if the text is actually outside the
rectangle. ReportBuilder uses your printer driver to render to the screen
and in the conversion process from printer pixels to screen pixels, some
precision is lost. Feel free to send an example to
support@digital-metaphors.com if you are still experiencing a problem.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com