Jump to content

Recommended Posts

9 minutes ago, A.M. Hoornweg said:

Static class methods are unable to access any members or methods that require a "self" parameter.  

As a result it can not be assigned to an event.

Share this post


Link to post
10 hours ago, dummzeuch said:

Alternatively one could create a plain procedure with the right signature, assign that to the code pointer of a TMethod record, leave the data pointer unassigned or set it to nil, and assign that record to the event using appropriate type casting.

That's the way I usually do it when I need an event handler without an object instance.

Share this post


Link to post
On 10/27/2024 at 8:25 AM, Olli73 said:

As local variable it is not initialized, as global it is.

This not entirely correct - all basic types aren't. Strings, interfaces and dynamic arrays are initialized to nil.

Share this post


Link to post
52 minutes ago, mikerabat said:

Strings, interfaces and dynamic arrays are initialized to nil.

Often called managed types in Delphi code, because the compiler manages the lifetime of the heap memory used by those types.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×