[Lazarus] Installing custom control in Lazarus - where can I find it?

Bo Berglund bo.berglund at gmail.com
Thu Aug 27 22:51:00 CEST 2020


I am (again) trying to port a Delphi application to Lazarus/FPC.
This time I need a customized version of TListView, which I converted
to use in Lazarus back in 2018.
See thread titled:
"Converting a component package Delphi->Lazarus using built-in
converter?"

I found the files for the converted component on my disk as:
easylistview.lpk THis is the package file 
EasyListView.pas
EasyListView.dcr

No using Lazarus 2.0.8 and FPC 3.0.4 I did the following:
- Started Lazarus
- Told it to start a new project (to not interfere with my current
project)
- Package/Open package file
- Navigated to the easylistview.lpk file
- Clicked the Compile button. Finished successfully.
- Use/Install. Lazarus started to rebuild itself
- No visible errors shown
- Lazarus restarted

Now, how do I find the component I just installed so I can use it?
I expected a new tab named AGI to appear with the component inside of
it but I cannot find it...

This is what is (or rather was, see below) in the register procedure
in EasyListView.pas:

procedure Register;
begin
	RegisterComponents('AGI', [TEasyListView]);
end;

And this is the lpk file content after the compile/install:

<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
  <Package Version="4">
    <PathDelim Value="\"/>
    <Name Value="EasyListView"/>
    <Type Value="RunAndDesignTime"/>
    <CompilerOptions>
      <Version Value="11"/>
      <PathDelim Value="\"/>
      <SearchPaths>
        <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
      </SearchPaths>
    </CompilerOptions>
    <Files Count="1">
      <Item1>
        <Filename Value="EasyListView.pas"/>
        <UnitName Value="EasyListView"/>
      </Item1>
    </Files>
    <RequiredPkgs Count="1">
      <Item1>
        <PackageName Value="IDEIntf"/>
      </Item1>
    </RequiredPkgs>
    <UsageOptions>
      <UnitPath Value="$(PkgOutDir)"/>
    </UsageOptions>
    <PublishOptions>
      <Version Value="2"/>
    </PublishOptions>
    <CustomOptions Items="ExternHelp" Version="2">
      <_ExternHelp Items="Count"/>
    </CustomOptions>
  </Package>
</CONFIG>

Now the strangest thing is that in this process Lazarus has completely
mangled the EasyListView.pas source file so it now only has this
content wheras the original was 27 kbytes....:


{ This file was automatically created by Lazarus. Do not edit!
  This source is only used to compile and install the package.
 }

unit EasyListView;

{$warn 5023 off : no warning about unused units}
interface

uses
  LazarusPackageIntf;

implementation

procedure Register;
begin
end;

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


So it is overwriting the source file for the component with a
basically empty file, which it successfully installs and is nowhere to
be found....

Apparently I am doing something completely wrong here, but what?


-- 
Bo Berglund
Developer in Sweden



More information about the lazarus mailing list