The component needs to descend from TppStretchable, defined in ppStrtch.pas. For an example, see TppCustomMemo defined in ppMemo.pas.
For an example of a very simple component, see RBuilder\Demos\RCL.
Stretchable components include Memo, RichText, Crosstab, Subreport, and Region. Stretchable components can grow/shrink their height as needed to accomodate their contents. Stretchable components can also participate in ShiftRelativeTo relationships with other stretchable components.
Best regards,
Nard Moseley Digital Metaphors www.digital-metaphors.com
I have chosen to create my own SubReport component. But now my problem is the following one. How to know when I must create the components that will compose each band? And like doing this?
I want that my SubReport has by defect a TppImage in the band details. During the process of generation of the report this TppImage loaded a created image dynamically. How to know when I must create the components that will compose each band? What procedures I must override? And like doing this?
One solution is connect the subreport.DataPipeline to a JITPipeline. See the JITPipeline tutorial in the RB Developers Guide. Here is a tech tip for using the JITPipeilne .OnGetPicture event
---------------------------------------------------- Tech Tip: Using the JITPipeilne OnGetPicture Event to display images ----------------------------------------------------
Question --------
I am using a JITPipeline to output data stored in a series of stringlists, one of these stringlists contains the names of a graphic.
How can I use the JITPipeline.OnGetPicture Event to display an image?
Solution --------
1. Use JITPipeline fields editor to declare a Field with FieldType = dtGraphic. For this example, set the FieldName to 'Graphic'. Create a second Field with FieldType = dtString and set the FieldName to 'GraphicFile'.
2. In the Report Designer, create a DBImage component and connect to the Graphic field.
3. Use the Delphi code editor to declare a private variable for your form:
private FPicture: TPicture;
4. In the FormCreate event instantiate the picture object:
procedure TForm1.FormCreate(Sender: TObject); begin
FPicture := TPicture.Create;
end;
5. In the FormDestroy event, free the picture object:
procedure TForm1.FormDestroy(Sender: TObject); begin
FPicture.Free;
end;
6. In the JITPipeline.OnGetPicture event, load the picture:
function TForm1.ppJITPipeline1GetFieldAsPicture(aFieldName: String): TPicture; var lsFileName: String; begin
if aFieldName = 'Graphic' then begin lsFileName := JITPipeline['GraphicFile'];
I want to encapsulate all this operation in a custom SubReport control. The problem continues being the same one. I have created a SubReport control, and want to create the controls that compose each band dynamically. The problem is that the bands are not created until the designer is visualized, reason why not that method must override so that the controls are created at the suitable moment.
It is possible to change the class with which a band is due to create? It is possible to recreate the band details with another class?
See the CodeBased thread of the tech tips newsgroup. It describes how to create a report layout in code. The subreport.Report property can be used to access the childreport object and add band, components, etc.
You should create the report layout prior to generating the report. That means either prior to calling Report.Print or in the Report.InitializeParameters event.
Best regards,
Nard Moseley Digital Metaphors www.digital-metaphors.com
Comments
The component needs to descend from TppStretchable, defined in ppStrtch.pas.
For an example, see TppCustomMemo defined in ppMemo.pas.
For an example of a very simple component, see RBuilder\Demos\RCL.
Stretchable components include Memo, RichText, Crosstab, Subreport, and
Region. Stretchable components can grow/shrink their height as needed to
accomodate their contents. Stretchable components can also participate in
ShiftRelativeTo relationships with other stretchable components.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I have chosen to create my own SubReport component. But now my problem is
the following one. How to know when I must create the components that will
compose each band? And like doing this?
Thanks,
Manuel GC.
What is the source of the image data?
I do not understand what you are trying to accomplish. Perhaps you can
provide more details.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I want that my SubReport has by defect a TppImage in the band details.
During the process of generation of the report this TppImage loaded a
created image dynamically.
How to know when I must create the components that will compose each band?
What procedures I must override?
And like doing this?
Thanks,
Manuel GC
One solution is connect the subreport.DataPipeline to a JITPipeline. See the
JITPipeline tutorial in the RB Developers Guide. Here is a tech tip for
using the JITPipeilne .OnGetPicture event
----------------------------------------------------
Tech Tip: Using the JITPipeilne OnGetPicture Event
to display images
----------------------------------------------------
Question
--------
I am using a JITPipeline to output data stored in a series of stringlists,
one of these stringlists contains the names of a graphic.
How can I use the JITPipeline.OnGetPicture Event to display an image?
Solution
--------
1. Use JITPipeline fields editor to declare a Field with FieldType =
dtGraphic. For this example, set the FieldName to 'Graphic'. Create a second
Field with FieldType = dtString and set the FieldName to 'GraphicFile'.
2. In the Report Designer, create a DBImage component and connect to the
Graphic field.
3. Use the Delphi code editor to declare a private variable for your form:
private
FPicture: TPicture;
4. In the FormCreate event instantiate the picture object:
procedure TForm1.FormCreate(Sender: TObject);
begin
FPicture := TPicture.Create;
end;
5. In the FormDestroy event, free the picture object:
procedure TForm1.FormDestroy(Sender: TObject);
begin
FPicture.Free;
end;
6. In the JITPipeline.OnGetPicture event, load the picture:
function TForm1.ppJITPipeline1GetFieldAsPicture(aFieldName: String):
TPicture;
var
lsFileName: String;
begin
if aFieldName = 'Graphic' then
begin
lsFileName := JITPipeline['GraphicFile'];
FPicture.LoadFromFile(lsFileName);
end;
Result := FPicture;
end;
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
another solution?
I want to encapsulate all this operation in a custom SubReport control.
The problem continues being the same one.
I have created a SubReport control, and want to create the controls that
compose each band dynamically.
The problem is that the bands are not created until the designer is
visualized, reason why not that method must override so that the controls
are created at the suitable moment.
It is possible to change the class with which a band is due to create? It
is possible to recreate the band details with another class?
Thanks,
Manolo G.C
See the CodeBased thread of the tech tips newsgroup. It describes how to
create a report layout in code. The subreport.Report property can be used to
access the childreport object and add band, components, etc.
You should create the report layout prior to generating the report. That
means either prior to calling Report.Print or in the
Report.InitializeParameters event.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com