|Subject:||Re: Access instance created in with .. do|
|Posted by:||Christian Gorski (email@example.com)|
|Date:||Wed, 21 Jun 2006|
> First of all "with" is evil ! :-))
> Second, if you really insist on using it, then you need to add a method,
> that returns self, to the class that you are trying to use
> TObj = class
> function GetThis: TObj;
> function TObj.GetThis: TObj
> return self;
That´s not an option for me.
> Thirdly, if you are going to call free in the with block I suggest you also
> include a correctly declared try..finally block inside it.
> with TObj.Create do
It was only a simple example not taken from real life to show what I am
talking about. ;-)
> But better still would be to do things properly and not have to mess up your
> classes for the sake of a couple of extra keypresses when typing the code.
> obj: TObj;
> obj := TObj.Create;
This is especially what I didn´t want to type, but obviously I have to.
Re: Access instance created in with .. do posted by Joanna Carter [TeamB] on Wed, 21 Jun 2006