Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

Adding Code to TppComponent Event at run-time

edited January 2003 in End User
How can I add event code to a TppComponent on a report at runtime. For
example, I have a report with TppLabel component on it and I want to change
the code that alreay exists in the OnPrint event. I will then save the
report with the new OnPrint code so that when I load the report next time in
the Designer the new OnPrint code is there.

Thanks,
Scott

Comments

  • edited January 2003
    Do you mean RAP code?

    To change a RAP event handler at runtime, you can extract the code module
    and change the "program" for that event handler.

    Here is an example of moving a BeforePrint event of a group to another group
    in code:

    http://www.digital-metaphors.com/tips/MoveGroupHeaderBeforePrint.zip

    You can use a similar approach to find the label's OnPrint event handler,
    then modify the text lines of the EventHandler's SourceLines property.

    Then you can save the template with the new code module.

    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited January 2003
    Is there any documentation on TraCodeModule, TraProgram and any other RAP
    specific classes? I want to manipulate the RAP code for a series of reports
    via code and it would be extremely beneficial to know what Methods and
    Properties were available. Since the source for RAP is not available it
    would be nice to have a Help File or some other form of documentation.

    Thanks,
    Scott

  • edited January 2003
    RAP documentation is not distributed, as it is a double top secret class
    library. RTTI can provide a lot of information though. Some customers have
    used the code insight and code completion of Delphi (and Coderush) to see
    the available methods, properties and parameters for the method calls. Here
    are some other RAP tips:

    http://www.digital-metaphors.com/tips/RAPCreateGlobalVar.zip

    http://www.digital-metaphors.com/tips/RAPCreateGlobalProc.zip

    There are also a couple of examples of creating RAP code in the RAP demos of
    the RBuilder installation.

    If there is something you need (I'm working on an example for your other
    post/question), I can throw together an example showing how to do it.
    Basically, the demos show most of what you'll need to change the programs at
    runtime.

    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited January 2003
    Thanks Jim.

This discussion has been closed.