Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


FastReports BlobType

aloveralover Member Posts: 2
I Need help with FastReports Runtime coding.

Anyone familiar with FastReports?

How can I change the BlobType of a TPictureView object for each record.

( This is Necessary because picture can be Bmp, Jpg or Ico and the
TfrPictureView Object.BlobType MUST be set accordingly else error)

It is easy when the TfrPictureView objects exist at design time.
I put this code into the band's OnbeforePrint event:

if [tblAddress."BmpType"] = 0 then
Picture1.BlobType := btBmp
if [tblAddress."BmpType"] = 1 then
Picture1.BlobType := btJpg;
if [tblAddress."BmpType"] = 2 then
Picture1.BlobType := btIco;

This works fine.

BUT it does not work for frPictureView objects created at runtime.

----Summary of program purpose ------
I have written a Labeling program that allows users to create there own
label templates.
They can add text, Memo, Images, Barcodes, shapes, Polygons & stars.
They can position and size all objects however they like.
These templates are then stored in a database.
They can then select a template and either print Multiple copies of
the same label or they can select to print Address labels from an
address database.

If they want to print Address labels they can link any of the template objects to any field in the Address database.
One of these fields is a BlobField.
This is the one where the picture image is stored.

Problem explanation
This report ALWAYS starts empty except for a TfrBandView object.

I am creating and adding components to the report at runtime.
These components are then linked to fields in a DBIsam database (tblAddress).
When Printing, the data for each component comes from the database.

The problem is that when the component is a TfrPictureView, I need to be able to change the TfrPictureView.BlobType in code for each record depending on the image type.
This is because the picture type can be either of " BMP, JPG or ICO "

I have the BlobType at runtime, stored in [tblAddress."BmpType"]
I do NOT have the Name of the TfrPictureView object as it was created at runtime.

I have added code to the TfrBandView OnBeforePrint event but FastReport
is ignoring it, probably because of wrong syntax.

I believe I must find the name of the current object that is printing
so that I can then change the Blobtype IF it is a TfrPictureObject
then this should work .

if (CurrentObject is TfrPictureView) then
CurrentObject.BlobType := [tblAddress."BmpType"];

but how do I get the CurrentObject ??
Or is there an easier way to approach this problem?

FastReports is a great powerful report system but it has some drawbacks.

One problem is that MOST objects do NOT appear to have an OnBeforePrint event.
You have to use the Page or Band OnBeforePrint for everything.

Another problem is that it is VERY difficult to add your own code or to
get/set report object properties at runtime.

There are very few examples of code and the ones supplied only cover simple obvious stuff.
It would be nice to see at least SOME advanced runtime code in the examples
Without it, it is a long and hard road getting the syntax correct for runtime code.

Hope somebody out there has mastered FastReports and can give me some ideas.
So far I have found NOBODY that even uses it.


Sign In or Register to comment.