[Lazarus] Example of TObjectList sorting

Ondrej Pokorny lazarus at kluug.net
Sun May 22 12:22:49 CEST 2016


You are using "procedure of object" where you need "procedure".

(One solution is to add static keyword to your procedure declaration, if 
the FPC version you use supports the typecast - iirc, fpc 3.0.0 can't do 
that in objfpc mode.)


Ondrej


On 22.05.2016 12:17, Richard Mace wrote:
> Thanks Denis,
>
> I am now getting:
>
> inboundroutedestlist.pas(49,35) Error: Incompatible type for arg no. 
> 1: Got "<procedure variable type of function(Pointer;Pointer):LongInt 
> of object;Register>", expected "<procedure variable type of 
> function(Pointer;Pointer):LongInt;Register>"
>
> Any ideas?
>
> Richard
>
> On 22 May 2016 at 07:30, Denis Kozlov <dezlov at gmail.com 
> <mailto:dezlov at gmail.com>> wrote:
>
>
>     On 21 May 2016 at 13:49, Richard Mace <richard.mace at gmail.com
>     <mailto:richard.mace at gmail.com>> wrote:
>
>         ​Would I call the List.sort externally, or would the List call
>         sort when an Add has happened, as I don't seem to have a
>         ".sort" method on my TObjectList?
>
>
>     You need to call List.Sort yourself, it is not sorted
>     automatically when you add more elements.
>
>     TObjectList does have a Sort method, since it descends from TList
>     class.
>
>     Denis
>
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160522/2e7dea72/attachment-0003.html>


More information about the Lazarus mailing list