[Lazarus] Parameter types for events
Mattias Gaertner
nc-gaertnma at netcologne.de
Thu Feb 19 10:57:07 CET 2015
On Thu, 19 Feb 2015 09:34:29 +0000
Mark Morgan Lloyd <markMLl.lazarus at telemetry.co.uk> wrote:
> I've got these methods
>
> procedure OnAfterShow(afterShowParam: LONGINT);
> procedure OnAfterOverridesVisibleClick(count: LONGINT);
>
> which are used like this
>
> Application.QueueAsyncCall(@OnAfterShow, startParam)
> end { TMainForm.FormCreate } ;
>
> On 32-bit systems the parameter type is a longint, but x64 requires Int64.
>
> What's the correct type to ensure portability in this case?
Use "Find declaration" to find out:
procedure QueueAsyncCall(const AMethod: TDataEvent; Data: PtrInt);
TDataEvent = procedure (Data: PtrInt) of object;
Or simply let the IDE generate the method for you:
1. type the line
Application.QueueAsyncCall(@MyFunc, Param);
2. place cursor on MyFunc
3. press complete code (Ctrl+Shift+C)
This will create the method
procedure MyFunc(Data: PtrInt);
Mattias
More information about the Lazarus
mailing list