I need the call an Initialization routine in all the forms of my application, it is an Intraweb application so in fact I will use OnIWAppFormCreate
and not OnFormCreate
, anyway the problem is the same.
I have 2 techniques in mind:
Use Visual Form Inheritance: in this case I create a BaseForm in which I implement the FormCreate event and in inherit all forms from this
I add a global procedure and I call it from all forms
Both these tecnhiques make me edit each form.
Is there a way to avoid this?
In fact what I need to do is to add the same string to the TIWAppForm.ExtraHeader stringlist property.
This is the code i need to add to each form:
ExtraHeader.Add('<link rel="stylesheet" type="text/css" href="/css/mycustomcss.css">');
Somehow I'd like to know if there is a way to code this only once with a tecnhique I am not aware of.
Thanks.
The best solution is to inherit from a base form, even because in almost all my forms i coded the OnFormCreate so to implement my task i did:
create a base form inheriting from TIWAppForm
in the unit declaration i inherit from the base form
in the dfm i replace object
with inherited
in the FormCreate of all forms i call inherited
explicitly