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

Werner Pamler werner.pamler at freenet.de
Sat Jun 9 11:27:11 CEST 2018


Am 08.06.2018 um 20:08 schrieb Bo Berglund via Lazarus:
> 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"

Are the '@' correct? I thought you are in mode DELPHI.

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

I think this is correct. I converted a lot of Delphi packages this way, 
without the converter - it gives me more control of what is happening.



More information about the Lazarus mailing list