Registering components
All components registration is performed in “Initialization” section.
initialization
{ use standard pictures indexes 37,38,39 instead of pictures}
frxObjects.RegisterObject1(TfrxIBXDataBase, nil, '', '', 0, 37);
frxObjects.RegisterObject1(TfrxIBXTable, nil, '', '', 0, 38);
frxObjects.RegisterObject1(TfrxIBXQuery, nil, '', '', 0, 39);
finalization
frxObjects.Unregister(TfrxIBXDataBase);
frxObjects.Unregister(TfrxIBXTable);
frxObjects.Unregister(TfrxIBXQuery);
end.
This is quite enough to use our DB components in reports. There are two more things left at this stage: register DB classes in the script system in order to make them available in the script, and to register several property editors (for example, TfrxIBXTable.TableName) to make working with the component easier.
It is better to store the script registration code in a separate file with RTTI suffix. See more about classes registration in script system in corresponding chapter. Here is example of such file:
unit frxIBXRTTI;
interface
{$I frx.inc}
implementation
uses
Windows, Classes, fs_iinterpreter, frxIBXComponents
{$IFDEF Delphi6}
, Variants
{$ENDIF};
type
TFunctions = class(TfsRTTIModule)
public
constructor Create(AScript: TfsScript); override;
end;
{ TFunctions }
constructor TFunctions.Create;
begin
inherited Create(AScript);
with AScript do
begin
AddClass(TfrxIBXDatabase, 'TfrxComponent');
AddClass(TfrxIBXTable, 'TfrxCustomDataset');
AddClass(TfrxIBXQuery, 'TfrxCustomQuery');
end;
end;
initialization
fsRTTIModules.Add(TFunctions);
end.