On 2013-09-15 04:22, Marc Santhoff wrote: > How do you handle this? > How can I meet the spec and put all global into the .dpr-file?
I use the Singleton design pattern for the solution. I often create a Application Class (nothing to do with TApplication) that keeps track of such things like global user preference, lookup lists etc. If other units require references I refactor my class structure so I have some base class I can pass in to other units. Those units then reference the passed in instance, and never the original application class (and related unit) directly. This is called Dependency Injection - yet another software design pattern that removes hard-coded dependencies. Design Patterns are your friend! ;-) Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
