On 27 March 2012 06:03, Frank Church <[email protected]> wrote: > On 23 March 2012 14:15, <[email protected]> wrote: >> >> >> On Fri, 23 Mar 2012, Michael Fuchs wrote: >> >>> Am 23.03.2012 14:55, schrieb Frank Church: >>>> >>>> [...] I'd prefer to look only at the public section and say, Oh, >>>> this is what it does for the program's other modules. Whatever isn't >>>> there is not relevant to the rest of the application. >>>> >>>> I understand that it comes from a Delphi legacy as RAD tool dating >>>> from a time when the principles underlying object orientation had not >>>> properly sunk in. [...] >>> >>> >>> You can already do this by changing the way you are programming. Just >>> write a class which only publish the needed methods and properties to the >>> outside. >>> Don't let the Application create and control your forms, move this to your >>> class. So, your class hides the forms, datampdules and other stuff. >> >> >> That's what I do too. >> >> unit appforms; >> >> type >> TBaseMyForm = Class(TForm) >> // Define public interface >> end; >> TBaseMyFormClass = Class of TBaseMyForm; >> >> Var >> MyFormClass : TBaseMyFormClass = Nil >> >> And then somewhere: >> >> >> >> Type >> TForm = TBaseMyForm; >> >> TMyForm = Class(TForm); >> // Regular lazarus definition of form >> end; >> >> initialization >> MyFormClass = TMyForm; end; >> >> And then, whenever I need an instance of TBaseMyForm: >> >> F:=MyFormClass.Create(Self); >> >> You could even substitute the complete TMyForm form with another one, >> depending on >> configuration options. >> >> Michael. >> > > Will I be able to develop TMyForm in the Object Inspector as usual, > although TForm has been redefined as a class of TMyForm? Will the unit > in which TMyForm defined still use the Forms unit, or will that be > inherited from the inclusion of the unit appforms (in your example)? > > Is there some place in the Free Pascal or Object Pascal docs that the > principles are explained? > > >> >> -- >> _______________________________________________ >> Lazarus mailing list >> [email protected] >> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > > > -- > Frank Church > > ======================= > http://devblog.brahmancreations.com
Any updates? Does any one else have some examples? -- Frank Church ======================= http://devblog.brahmancreations.com -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
