Picture (Image) Object Verification
Hi,
I can't seem to find how to check whether an image was successfully pulled dynamically via a Db record set.
I have defined the FileLink location correctly as in F:\Sites\EacLive\downloads\facilities\photos\[A_Fetch_A_Accommodation_Search."FacilityID"].jpg but not all of my Facilities have a related image.
In these instances, I need to hide the image object and show a "No Image Available" icon instead.
Via the command line browser, my report displays great (I had set the transparent colour to clWhite and simply placed the "No Image" image below my dynamic one). In those instances, the missing image is not displayed and so the "No Image" one (that is below it) shows through.
However, when exporting to pdf, the "missing" dynamic images display white and so the "No Image" picture remains overlayed and so still can't be seen.
My question is this: Is there a flag or event I can use to check in my OnBeforePrint function whether to hide or show my relevant images?
Many thanks, RSVP.
Andrew F.
I can't seem to find how to check whether an image was successfully pulled dynamically via a Db record set.
I have defined the FileLink location correctly as in F:\Sites\EacLive\downloads\facilities\photos\[A_Fetch_A_Accommodation_Search."FacilityID"].jpg but not all of my Facilities have a related image.
In these instances, I need to hide the image object and show a "No Image Available" icon instead.
Via the command line browser, my report displays great (I had set the transparent colour to clWhite and simply placed the "No Image" image below my dynamic one). In those instances, the missing image is not displayed and so the "No Image" one (that is below it) shows through.
However, when exporting to pdf, the "missing" dynamic images display white and so the "No Image" picture remains overlayed and so still can't be seen.
My question is this: Is there a flag or event I can use to check in my OnBeforePrint function whether to hide or show my relevant images?
Many thanks, RSVP.
Andrew F.
Comments
No response.
Does this mean FastReports doesn't give the ability to do File management checks such as FileExists?
I wish I could find a document that lists all the functions available to me within FastReports :-(
I need to be able to check that the file I'm about to assign to a Picture Object Exists.
I'm using the direct FastReports generator to do this work using C++ scripting but am struggling with the limted set of functions it looks like are available.
Am I missing a trick here? Are there some #includes or suchlike that give me huge libraries of functionality?
I've also seen examples of being able to use .gif files, but when I try to include the Picture.Bitmap.LoadfromFile(fileName) it fails telling me it can't convert to int.
Any help would be greatly appreciated, preferrably with example code (telling me "just use FileExists" isn't getting me anywhere because I can't just use...).
Thank you all, before, during and after :-)
unit myfrfunctions;
interface
implementation
uses
SysUtils, Classes, fs_iinterpreter;
type
TFunctions = class(TfsRTTIModule)
private
function CallMethod(Instance: TObject; classType: TClass; const
MethodName: string; var Params: Variant): Variant;
public
constructor Create(AScript: TfsScript); override;
end;
function myFileExists(aFileName: string): Boolean;
begin
Result := SysUtils.FileExists(aFileName);
end;
constructor TFunctions.Create(AScript: TfsScript);
begin
inherited Create(AScript);
with AScript do
begin
AddMethod('function DateiExistiert(aDateiName: string): Boolean',
CallMethod, 'Datei', 'Pruft, ob eine Datei vorhanden ist');
end;
end;
function TFunctions.CallMethod(Instance: TObject; classType: TClass;
const MethodName: string; var Params: Variant): Variant;
begin
if upperCase(MethodName) = 'DATEIEXISTIERT' then
Result := myFileExists(Params[0]);
end;
initialization
fsRTTIModules.Add(TFunctions);
end.
That's brilliant. Thank you so much! You've also given me the shell to begin to add my own funcs now I get the structure.
I'll try it tonight.
Thank you soooooo much :-D
Hi Gord,
I try this, I include it in my Delphi unit, include it in my FR script code, but I do not see the function in the FR functions list at design time.
I want to see it at design time and I want to be able to run the report from within the designer in the usual way, with working user functions.
What am I missing here?