[Pas2js] How to access a private field (avoiding JS)?
silvioprog
silvioprog at gmail.com
Fri Jan 11 20:29:05 CET 2019
Hello,
please consider the following partial code containing a read-only property
(Owner):
...
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.
Thank you!
--
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20190111/0f728632/attachment.html>
More information about the Pas2js
mailing list