[Lazarus] patch for lazreport (TfrPictureView.getBlob)

Jesus Reyes jesusrmx at yahoo.com.mx
Mon Dec 1 20:02:34 CET 2014


Because you are getting the image data from a different source than the dataset itself, traditionally you do this in the event OnEnterRect which exists for this kind of situations, see for an example the Thumbnails Report in the lazreport/samples/editor sample, I quote here the relevant part:

procedure TfrmMain.TheReportEnterRect(Memo: TStringList; View: TfrView);
begin
  if (FImageList<>nil) and (View.Name='thumbnail') then begin
    TFrPictureView(View).Picture.LoadFromFile(FImageList[FImageListIndex]);
    Inc(FImageListIndex);
  end;
end;

In your case you could probably do something like this:

if View is TfrPictureView then begin
  TfrPictureView(View).Picture.LoadFromFile(
    'test' + myQuery.FieldByName('Test_Int').asString+'.bmp')
end;

Which looks more simply than your proposed solution.

Regards.

Jesus Reyes A.





More information about the Lazarus mailing list