Difference between revisions of "Register (package)"

From Lazarus wiki
(what exactly is registerpackage versus registerunit etc?)
Line 3: Line 3:
 
* the tab on which the [[component]]s are to be located.
 
* the tab on which the [[component]]s are to be located.
  
Related procoedures/functions
+
Related procedures/functions
* [[RegisterUnit]]
+
* [[RegisterUnit]]  
 
* [[RegisterPackage]]
 
* [[RegisterPackage]]
 
* [[RegisterComponents]]
 
* [[RegisterComponents]]
Line 16: Line 16:
  
 
   uses  
 
   uses  
     LazarusPackageIntf, MyPackage1, MyPackage2;
+
     LazarusPackageIntf, MyPackage1, MyPackage2, MyOtherPackage;
  
 
implementation
 
implementation
Line 22: Line 22:
 
procedure Register;
 
procedure Register;
 
begin
 
begin
   RegisterUnit( 'MyTab', @MyPackage1.Register);
+
   RegisterUnit( 'MyTab', @MyPackage1.Register );
   RegisterUnit( 'MyTab', @MyPackage2.Register);
+
   RegisterUnit( 'MyTab', @MyPackage2.Register );
 +
  RegisterComponents( 'OtherTab', [TOtherComponent1,TOtherComponent2] );
 
end;
 
end;
  

Revision as of 21:12, 20 July 2016

A Lazarus package that is intended to be installed needs a Register procedure which declares

  • all the package components and corresponding files
  • the tab on which the components are to be located.

Related procedures/functions

unit RegisterMyPackage;

interface

  uses 
    LazarusPackageIntf, MyPackage1, MyPackage2, MyOtherPackage;

implementation

procedure Register;
begin
  RegisterUnit( 'MyTab', @MyPackage1.Register );
  RegisterUnit( 'MyTab', @MyPackage2.Register );
  RegisterComponents( 'OtherTab', [TOtherComponent1,TOtherComponent2] );
end;

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