Difference between revisions of "Register (package)"

From Lazarus wiki
Line 6: Line 6:
 
* [[RegisterPropertyEditor]]
 
* [[RegisterPropertyEditor]]
 
* [[RegisterIDEMenuCommand]]
 
* [[RegisterIDEMenuCommand]]
 +
 +
<syntaxhighlight>
 +
unit RegisterMyPackage;
 +
 +
interface
 +
 +
  uses
 +
    LazarusPackageIntf, MyPackage1, MyPackage2;
 +
 +
implementation
 +
 +
procedure Register;
 +
begin
 +
  RegisterUnit( 'MyTab', @MyPackage1.Register);
 +
  RegisterUnit( 'MyTab', @MyPackage2.Register);
 +
end;
 +
 +
initialization
 +
  RegisterPackage( 'MyTab', @Register );
 +
end.
 +
</syntaxhighlight>
 +
  
 
[[Category:Packages]]
 
[[Category:Packages]]

Revision as of 20:51, 27 June 2014

A Lazarus package that is intended to be installed needs a Register procedure which declares all the packages components and corresponding files as well the tab on which the components are to be located.

unit RegisterMyPackage;

interface

  uses 
    LazarusPackageIntf, MyPackage1, MyPackage2;

implementation

procedure Register;
begin
  RegisterUnit( 'MyTab', @MyPackage1.Register);
  RegisterUnit( 'MyTab', @MyPackage2.Register);
end;

initialization
  RegisterPackage( 'MyTab', @Register );
end.