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:
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

  • gordkgordk St.Catherines On. Canada.
    edited 4:31PM
    if you retrieved the overlay variable of type tfrxoverlay using the findobject method then
    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.
  • edited February 2009
    Unfortunately it didn't change anything. I did 3 screens to provide some more information on my problem.

    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


  • edited 4:31PM
    I prepared a very simple application which presents the discussed problem.
    http://www9.zippyshare.com/v/31095095/file.html

    Thanks for your help in advance!
  • gordkgordk St.Catherines On. Canada.
    edited 4:31PM
    i suspect your problem is that you have 2 overlays.
    only one overlay per design page
  • edited 4:31PM
    gordk wrote: »
    i suspect your problem is that you have 2 overlays.
    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]
  • gordkgordk St.Catherines On. Canada.
    edited 4:31PM
    there are a number of things you can try.
    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.


Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.