Home End User

Correct way to call ppDesigner and also load templates

edited January 2018 in End User
Hello,

I have my own PreviewForm. Everything in my app is using reports loaded
from database, it's all RAP, no reports are in Delphi.

Everything works perfectly when I first load a report template from the
database.

In some reports that I have recently made, I am using onDrawCommandClick
to dynamically hide some labels. It works just fine until:

a) I load another report from a template (using
ppReport.Template.LoadFromStream)
or
b) I use ppDesigner.Showmodal and change the template


After LoadFromStream or showing the end user designer, when I try to
click on any of the components that have onDrawCommandClick events I get
major Access Violations, that sometimes cause even the entire EXE to be
killed. If Delphi is running, it doesn't show where the AV is, it's
somewhere in the click event.
Also, another symptom: sometimes instead of AV, when I try to click one
of these "click-active" components simply nothing happens. It's all
related to these clicks, only when I have such components that handle
onDrawCommandClick and only when I load a second template or invoice the
designer and then get back to my custom preview form. Basically, it
seems like it happens if I call PrintToDevices after the initial loading
of the template (and it's own first PrintToDevices).

Question:
Here is an excerpt of the code:

var MS: TMemoryStream;
.... load the stream from a blob from the database
ppReport.Template.LoadFromStream(MS);
ppReport.PrintToDevices;

Calling the designer is even simpler:
ppDesigner.ShowModal;
ppReport.PrintToDevices;

The question is: is PrintToDevices all I need to call after
LoadFromSTream or after calling the designer, where basically the
template is modified by the end user (to any extent, we use everything)?

Do I have to call ppReport.Reset, or Report.Engine.Reset or any other
method, or PrintToDevices is THE thing to call and that's it (and my
problem is somewhere else)?

The reason I am asking is because initially when I show the preview form
and load the template the first time (from the stream with the code
above) it works just fine. I am thinking - after the template is already
loaded, do I have to do something to cleanup and start fresh, reset,
initialize something after the template is changed or another one is
loaded from the database?

Thank you.

Best regards,
Dimitar

Comments

  • edited January 2018
    Hi Dimitar,

    Are you able to recreate this behavior with a simple example? If so,
    please send the example in .zip format along with your current serial
    number and purchasing email address to support@digital-metaphors.com and
    we'll take a look at it for you.


    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.