Creating TfrxPictureView at run time
Hi,
I was trying to add a picture object to an existing report (in Delphi code) and I encountered the following problem.
I loaded the *.fr3 file:
and then I wrote sth. like that:
My point is that the picture is not beeing shown on the preview (although it's visible in the designer when I run it). What's more, when I changed the Owner (and Parent) to Report.Pages[1] the picture was visible. Even though I tried different combinations of Owner and Parent I didn't manage to create a picture on TfrxOverlay object and that's why I would be very grateful for Your help.
Nice greetings!
I was trying to add a picture object to an existing report (in Delphi code) and I encountered the following problem.
I loaded the *.fr3 file:
Report.LoadFromFile(PathToReportFile);
and then I wrote sth. like that:
Picture := TfrxPictureView.Create(Overlay.Report); //Overlay: TfrxOverlay, already existing in report and retrived via FindObject method
Picture.Parent := Overlay;
Picture.CreateUniqueName;
Picture.Picture.LoadFromFile(PathToImageFile);
Picture.SetBounds(5,5,50,50);
Report.ShowReport(false);
My point is that the picture is not beeing shown on the preview (although it's visible in the designer when I run it). What's more, when I changed the Owner (and Parent) to Report.Pages[1] the picture was visible. Even though I tried different combinations of Owner and Parent I didn't manage to create a picture on TfrxOverlay object and that's why I would be very grateful for Your help.
Nice greetings!
Comments
i expect
problem here
Picture := TfrxPictureView.Create(Overlay.Report);
should be
Picture := TfrxPictureView.Create(Overlay);
//set all other props of the pictureview making sure that the picture view top bound falls within the overlayband's bounds
then work with the picture.
The first one shows the original *.fr3, which is beeing loaded.
http://img17.imageshack.us/img17/9493/photoemptyki9.jpg
Picture3 which is visible on Overlay1 was added in designer by drag&drop method.
The second screen shows the preview window just after I added 4 images at run time (using the similar code to which I've already given).
http://img223.imageshack.us/img223/5140/emptypreviewjj2.jpg
The last one shows the designer window after pictures were added. The preview window still doesn't show them.
http://img262.imageshack.us/img262/1382/fulldesignerfz4.jpg
http://www9.zippyshare.com/v/31095095/file.html
Thanks for your help in advance!
only one overlay per design page
Indeed, that was where the problem was lying [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> But unfortunately this created another problem for me. I have to generate more advance and complex report at runtime with the scheme similar to this one: Raport header 'Some band' (layout taken from *.fr3 file, values set at run-time, no database connection within report) 'Some band' (containing images added at runtime) 'Some band' (layout taken from another *.fr3 file, values set at run-time, no database connection within report) 'Some band' (containing images added at runtime) (etc.) Raport footer I managed to create such report but I had to use TfrxChild component, which is 1) inconvenient when creating it at runtime (setting dependencies between bands) 2) rather unacceptable for me as the user will have to be able to change the order of bands on his own (which might be too difficult for him as he would have to change the dependencies between them as well) So my question is the following: Is there any other solution to this problem (e.g using another band type in some tricky way)? Nice greetings![/img]
any band can be desplayed by using the engine.showband(bandname) method.
childbands do not have to be attached they can be called using the above method.
you can also use the on manual build event.
and you can always run reports and append previewpages to a prior reports previewpages.