Perhaps as a small tip: I personally prefer to use a TDataModule (that gets created before the first/main form) that has such features nicely tucked away as that allows these implementations to be easily re-used for other projects). But an additional (non visual) unit that has some global procedures/functions and/or initialization section works just as well.
Happy Coding !
Thanks!
I think above hint is very important and would like to try out that idea.
I've searched for TDataModule in the components list, Ctrl+Alt+P without luck. So I'm assuming it is a customly defined class instantiated into an object somewhere in the initialization and/or startup sequence. Or?
I looked into the Wiki regarding startup and initialization and although somewhat informative, there are no examples indicating how this can be done, see
http://wiki.freepascal.org/Startup and
http://wiki.freepascal.org/Initialization.
In my applications .lpr file I have
begin
RequireDerivedFormResource:=True;
Application.Initialize;
// Insert instantiation of TDataModule here, or?
Application.CreateForm(TfrmMain, frmMain);
Application.CreateForm(TfrmClass, frmClass);
Application.CreateForm(TfrmGroups, frmGroups);
Application.CreateForm(TfrmStudent, frmStudent);
Application.Run;
end.
Is above location correct?
I realize there are multiple ways to accomplish custom application initialization, and that there are several pros and cons for each method. And hence there probably is no "best practice"? But it would be great to see an example of how this can be done.
Could you please elaborate on your hint? (should we move this to a new thread? feel free to instantiate a new thread)