[Pas2js] How to access a private field (avoiding JS)?
Mattias Gaertner
nc-gaertnma at netcologne.de
Fri Jan 11 22:38:22 CET 2019
On Fri, 11 Jan 2019 16:29:05 -0300
silvioprog <silvioprog at gmail.com> wrote:
>[...]
> class function TfrBase.Novo(AOwner: TComponent;
> ARequerLogin: Boolean): TfrBase;
>
> procedure DoAccess; //inline
> begin
> Result := Self.CreateNew; // it will create a form
> asm
> Result.FOwner = AOwner;
> end;
> Result.Popup := True;
> end;
> ...
>
> In the code above, I can't assign the new owner in an easy way like
> CreateNew(AOwner), cause the design of the third party component
> doesn't provide any overloaded option like CreateNew(AOwner:
> TComponent), then I've used the small asm block above to access the
> private field FOwner and change it. However, I would like to solve it
> in the Pascal-ish way to avoid asm blocks.
For example:
TJSObject(Result)['FOwner']:=AOwner;
Mattias
More information about the Pas2js
mailing list