Lazarus

Programming => Packages and Libraries => LazReport => Topic started by: gambothell on February 14, 2012, 08:44:26 pm

Title: Run time loading Picture in MasterData when record changes
Post by: gambothell on February 14, 2012, 08:44:26 pm
Lazarus 0.9.28.2-12 beta (Ubuntu 11.04)
FPC: 2.4.0
SVN Revision: 22277

I am using MySQL 5.1 in Lazarus Linux version. In LazReport I need to print a MySQL field which is a jpg. I am also using Zeos components.  Since you cannot display a MySQL picture in the DBImage, I am forced to load the stream into a TImage and save the picture to a temporary file. Now I can load the picture into the Picture1.Graphic. The problem is that when I place the Picture1 object into the MasterData band, I need to load the picture when the frDataSet.OnNext is triggered. So far I cannot get the Picture1 to load from the saved file. I have no problem in loading the TPicture using TfrPictureView(frReport1.FindObject('Picture1')).Picture.LoadFromFile(FPath+FileName); if the TPicture does not change in the report.

Any suggestions on how to load the TPicture in LazReport when it is in the MasterData band when the next record is read? I appreciate your help.
Title: Re: Run time loading Picture in MasterData when record changes
Post by: gambothell on February 14, 2012, 09:50:40 pm
 :D I found the solution:

procedure TForm1.frReport1EnterRect(Memo: TStringList;  View: TfrView);
begin
  if View.Name = 'Picture1' then
    TFrPictureView(View).Picture.LoadFromFile(FilePath+FileName);
end;
TinyPortal © 2005-2018