On Wed, 30 Jan 2013 11:18:08 +0000
Mark Morgan Lloyd <[email protected]> wrote:
> Given a fragment of code like this:
>
> type
> TDbConfigFrame = class(TFrame)
> ..
> public
> { public declarations }
> property DbInit: TDbConfigInit write fdbInit;
> end;
>
> 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?
Why not add a method
procedure TDbConfigFrame.SetDBInit(Setter: TComponent;
NewInit: TDbConfigInit);
begin
if not ((Setter is TForm) or (Setter is TNoteBook)) then
raise Exception.Create('not allowed');
fdbinit:=NewInit;
end;
Mattias
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus