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

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
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

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
Am 27.08.2020 um 22:51 schrieb Bo Berglund via lazarus:
> 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....:

I guess the component code is in unit EasyListView.pas and the package
is named EasyListview.lpk. This is bad because installation creates the
"package unit" with the same name as the package file, i.e. it
overwrites your component unit.

Remedy: give the package a different, more "package-like" name, e.g.
EasyListViewPkg, or LazEasyListView (also to distinguish from any Delphy
package). Carefully check the contents of the new LazEasyListView.lpk
file to make sure that the old package name is not mentioned any more
(or recreate the package from the start - this is not difficult and
almost no work).

IIRC, I had tried to convert this component some time ago, too, and
found it very difficult. Well, maybe because my intention was to make it
cross-platform.
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
Have restarted the lazarus just recompiled?

Il giorno 27 Ago 2020, alle ore 22:51, Bo Berglund via lazarus <[hidden email]> ha scritto:
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?


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Thu, 27 Aug 2020 23:27:27 +0200, Werner Pamler via lazarus
<[hidden email]> wrote:

>Am 27.08.2020 um 22:51 schrieb Bo Berglund via lazarus:
>> 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....:
>
>I guess the component code is in unit EasyListView.pas and the package
>is named EasyListview.lpk. This is bad because installation creates the
>"package unit" with the same name as the package file, i.e. it
>overwrites your component unit.
>
>Remedy: give the package a different, more "package-like" name, e.g.
>EasyListViewPkg, or LazEasyListView (also to distinguish from any Delphy
>package). Carefully check the contents of the new LazEasyListView.lpk
>file to make sure that the old package name is not mentioned any more
>(or recreate the package from the start - this is not difficult and
>almost no work).
>
>IIRC, I had tried to convert this component some time ago, too, and
>found it very difficult. Well, maybe because my intention was to make it
>cross-platform.

Hello Werner!
After posting this I late last night found a mail correspondence with
you from June 2018 where you helped me convert this very component!

And luckily the final files were attached in the email at the end of
the conversation so I could extract them.

Meanwhile I have had to replace my old Win7 computer and lost a lot of
files in the process... :(

Anyway now I have placed the files under subversion so that will not
happen again.

So I took these files (where the naming was better with a difference
between the package and the sourcefiles) and repeated the process and
it succeeded! I now have an EasyListView component on my Lazarus
palette!

This is very good because almost all of my old GUI style Delphi
projects used the component to display data and so is crucial to being
able to port them.

The reason I had forgotten our interaction could be that at the time
in 2018 I was convalescing from a bad fall from the roof of my house
and could barely move...

I want to (hopefully again) thank you so very much for your help at
the time!
 

--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Fri, 28 Aug 2020 07:46:02 +0200, Salvatore Coppola via lazarus
<[hidden email]> wrote:

>Have restarted the lazarus just recompiled?

Yes, that is automatic.

My problem was that I did not know that you are not allowed to have
the same name for all file in such a package with only an extension
difference!

See further my reply to Werner Pamler.


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
On Fri, 28 Aug 2020 08:14:09 +0200
Bo Berglund via lazarus <[hidden email]> wrote:

> On Fri, 28 Aug 2020 07:46:02 +0200, Salvatore Coppola via lazarus
> <[hidden email]> wrote:
>
> >Have restarted the lazarus just recompiled?  
>
> Yes, that is automatic.
>
> My problem was that I did not know that you are not allowed to have
> the same name for all file in such a package with only an extension
> difference!

https://wiki.freepascal.org/Lazarus_Packages#Create_a_package_with_a_unit_that_has_the_same_name_as_the_package

Mattias
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus