[Lazarus] Converting a component package Delphi->Lazarus using built-in converter?

Bo Berglund bo.berglund at gmail.com
Fri Jun 8 20:08:02 CEST 2018


On Fri, 8 Jun 2018 10:17:00 -0700 (MST), leledumbo via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:

>> Or is it just the converter that is havĂ­ng problems? 
>
>In the package dialog, check "Register unit" for units containing Register
>procedure. I didn't remember the last time I converted a Delphi package, but
>it could be that the converter doesn't detect Register properly.
>

I tried another approach, i.e. not using the converter at all.
Instead I tried creating a new package and then I have added manually
the main source files for the different components into the package
files collection.
I also added required package LCL and removed required package FCL.

Then I tried compiling and for the first few components all I had to
do was add an {$IFDEF DELPHI} bracket around some Delphi version
checking code and they compiled.
I also added this to the top of each component source file:
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
(I don't know if this is required on all source files or if there is a
master setting that enforces MODE DELPHI for the whole package).

But now I have run into a stop in one component, which is actually a
descendant of TListView where we have simplified usage by adding some
modified defaults and a few methods.
No I am getting errors I don't understand here:

procedure TEasyListView.DoColumnSort;
var
  SortStyle: TColumnSortStyle;
begin
  if ViewStyle <> vsReport then Exit;
  if not FColumnSorting then Exit;
  case ColumnSortStyle[ActiveSortColumn] of
    ssString: CustomSort(@SortByStringProc, FSortColumn);
    ssInteger: CustomSort(@SortByIntegerProc, FSortColumn);
    ssFloat: CustomSort(@SortByFloatProc, FSortColumn);
    ssImageIndex: CustomSort(@SortByImageIndexProc, FSortColumn);
    ssCustom: begin
      if Assigned(FOnColumnSortCompare) then
      begin
        UColumnSortCompare := FOnColumnSortCompare;
        CustomSort(@SortByCustomProc, FSortColumn);
        UColumnSortCompare := nil;
      end;
    end;
    ssNone: ; // Do nothing
  end;
end;

On every line mentioning CustomSort there is an error:
Error: Identifier not found "CustomSort"

CustomSort is an identifier in the parent TListView unless I am
mistaken. This error never appeared in Delphi...

Any ideas?

Did I start this new package in the wrong way? I simply used
Package/NewPackage to bring up the dialogs....


-- 
Bo Berglund
Developer in Sweden



More information about the Lazarus mailing list