[Lazarus] Controlling access to a method
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Wed Jan 30 13:34:16 CET 2013
Mark Morgan Lloyd schrieb:
> Given a fragment of code like this:
>
> type
> TDbConfigFrame = class(TFrame)
> ..
> public
> { public declarations }
> property DbInit: TDbConfigInit write fdbInit;
> end;
A write-only property can be implemented by a (setter) procedure, to
which you add whatever arguments may be useful (e.g. Sender).
> is there any way of enforcing a rule that DbInit can only be written by
> (for example) a descendant of TForm or TNotebook? Or only being writable
> by e.g. the OnCreate() method of certain designated form instances?
You can check Sender against the owner of the frame, if that helps.
DoDi
More information about the Lazarus
mailing list