Recent

Author Topic: XMLPropStorage, use GetAppConfigDir? (SOLVED)  (Read 5947 times)

mijen67

  • Full Member
  • ***
  • Posts: 130
  • It's hard to beat the bandwidth of a flying DVD
Re: XMLPropStorage, use GetAppConfigDir?
« Reply #15 on: January 02, 2018, 11:55:25 am »
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
Code: Pascal  [Select][+][-]
  1. begin
  2.   RequireDerivedFormResource:=True;
  3.   Application.Initialize;
  4.   // Insert instantiation of TDataModule here, or?
  5.   Application.CreateForm(TfrmMain, frmMain);
  6.   Application.CreateForm(TfrmClass, frmClass);
  7.   Application.CreateForm(TfrmGroups, frmGroups);
  8.   Application.CreateForm(TfrmStudent, frmStudent);
  9.   Application.Run;
  10. 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)

 

TinyPortal © 2005-2018