Register (package): Difference between revisions

From Lazarus wiki
Jump to navigationJump to search
No edit summary
m (Fixed syntax highlighting)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
A [[Lazarus Packages|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 [[component]]s are to be located.
A [[Lazarus Packages|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 [[component]]s are to be located.


* [[RegisterUnit]]
Related procedures/functions
* [[RegisterUnit]]  
* [[RegisterPackage]]
* [[RegisterPackage]]
* [[RegisterComponents]]
* [[RegisterComponents]]
Line 7: Line 10:
* [[RegisterIDEMenuCommand]]
* [[RegisterIDEMenuCommand]]


<syntaxhighlight>
<syntaxhighlight lang=pascal>
unit RegisterMyPackage;
unit RegisterMyPackage;


Line 13: Line 16:


   uses  
   uses  
     LazarusPackageIntf, MyPackage1, MyPackage2;
     LazarusPackageIntf, MyPackage1, MyPackage2, MyOtherPackage;


implementation
implementation
Line 19: 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;


initialization
initialization
  {$I myresourcefile.lrs}
   RegisterPackage( 'MyTab', @Register );
   RegisterPackage( 'MyTab', @Register );
end.
end.
Line 30: Line 36:


[[Category:Packages]]
[[Category:Packages]]
[[Category:Component Creation]]

Latest revision as of 08:38, 25 February 2020

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
  {$I myresourcefile.lrs}

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