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.
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;
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,
Comments
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
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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
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
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com