Home RAP

Get Report object from RAP.

edited May 2009 in RAP
Hello,

Is it possible to the get the Delphi TObject reference to the report that is
being created during a RAP function's ExecuteFunction?

Many Thanks

Steve Woods

Comments

  • edited May 2009
    Hi Steve,

    One option is to alter your pass-thru function signature to include the
    report as a parameter. This will ensure that the routine always has access
    to the current report.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2009
    Hello Nico,

    Thanks for the reply. This would solve the problems, we need to dynamically
    position elements horizontally and have made a pass thru function to get the
    length of a text string but the returned result is dependant upon the units
    being used in the report. Is there a better way to get this rather than
    passing in the report object to the function? And sorry if this is available
    elsewhere but could you fill in the blanks below?

    RAP Signature TextWidth(ReportObject: _______;Const S ; String) : Real;

    and from Script is this simple

    TextWidth(_____,'A Test String); ?

    Many thanks for your help,

    Steve Woods


  • edited May 2009
    Hi Steve,

    TextWidth(ReportObject: TppCustomReport;Const S ; String) : Real;

    Rather than send the entire report object, you might try just sending the
    report units being used...

    TextWidth(ReportUnits: TppUnitType;Const S ; String) : Real;

    To determine the text width you will need to use the TCanvas.TextWidth
    routine. To get access to a TCanvas object you can either create a TBitmap
    which will give you measurements in screen pixels, or use the printer's
    canvas which will give you printer pixels (more accurate). If you would
    like to use the printer, you will need to pass that as well as a parameter
    or use the first signature which passes the report.
    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

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