When I look at this code I see that you somehow overriding the definition of TForm, with a new kind of form. Doesn't it affect the existing TForm definition in some way?
I think I prefer to go with the Application extension route. I am not quite sure what I require exactly, but if I think I can subclass TApplication and implement the interface in it without changing any of the LCL code .dpr files are mainly source code so if I extend the Application with an interface, the forms just have to check if the Application implements the interface.
Will it be a matter simply using
if (Application is XXInterface) then
CallNecessaryRoutines
sure what ever floats your boat, keep in mind that the application was not mend to be inherited nor replaced, it is created before even the first line of code in the project is executed and if you destroy it in order to replace it it will uninitialize everything. You will be better of creating your own global variable that does not use the forms unit at all, which has its own rewards for one you might use it for non desktop applications too.
that's relatively easy to do with out much coding. Create a new unit and save it to a file write the code you want to execute test it debug it etc. Keep in mind that this is a simple pascal unit not a form so no LFM file must be create used etc.
unit uMyCustomForm;
interface
uses ...., forms;
TForm = class(Forms.TForm)
public
procedure DoMyThing;
end;
implementation
procedure TForm.DoMyThing;
begin
end;
Now for each form you want to have this ability make sure you add uMyCustomForm as the last unit in the uses clause or at least after the forms unit and you are ready to go.
What is the difference between
TSomeOtherForm = class(TForm)
public
procedure DoMyThing;
end;
and
TForm = class(Forms.TForm)
public
procedure DoMyThing;
end;
Easy of use in the first case you need to simple include the unit after the Forms unit and the persistent mechanism will create your new form on the second case you have to make sure that
1) the form is part of the project inluding that needs to have an lfm file.
2) all the forms that require the feature must inherite from that form which is a bit over complicated in my book.
In case you want to change the inheritance hierarchy for any reason you have to edit two or three different this way you edit nothing more than a uses clause.
using besides redefining TForm? What benefit does it offer?
the benefit are, easy of use and easy to change/discard, no secondary form needs to be part of the project, no inheritance to worry about, no designer support is required. Keep in mind that it does not redefine anything it simple puts a new class higher in the search hierarchy for the Tpersistent mechanism to choose it over the one in the forms unit.