Passing parameters to a delphi TFrame

Posted by ajob on Stack Overflow See other posts from Stack Overflow or by ajob
Published on 2009-03-05T14:16:47Z Indexed on 2010/05/02 5:27 UTC
Read the original article Hit count: 270

Filed under:
|
|

To avoid singletons and global variables I'd like to be able to pass parameters to a TFrame component. However since a TFrame normally is included on form at design time it is only possible to use the default constructor.

The parent form can of course set some properties in the OnCreate callback after the TFrame has been created. However this does not ensure that a property is not forgotten, and the dependencies are not as clear as using a constructor.

A nice way would be if it was possible to register a factory for creating components while the dfm file is being read. Then the required parameters could be passed to the TFrame constructor when created by the factory. Is there a way of accomplishing this?

Or does anyone have a better solution on how to pass parameters to a TFrame?

© Stack Overflow or respective owner

Related posts about delphi

Related posts about tframe