is there a way to reference an object instance that is created using the "with" statement?
Example:
with TAnObject.Create do
begin
DoSomething(instance);
end;
Where DoSomething would use the instance reference as if you were passing an instance from a variable declared reference to the object created.
Example:
AnObject := TAnObject.Create;
Thanks.
An addition to Brian's example on a Notify handler is to use an absolute variable (win32 only):
It basically avoids having to assign a local variable or have a lot of type casts.
There is a working fine hack to do so. Define this workaround function somwhere in project unit.
Usage example.