On Sun, Jan 9, 2011 at 3:56 PM, Hans-Peter Diettrich <[email protected]> wrote: > Marcos Douglas schrieb: >> >> If units are namespaces, why not use them in widgets declarations, >> automatic, in Lazarus? >> When we droped a widget in a Form, ie a TEdit, the declarion would be like >> this: >> TForm1 = class(Form) >> Edit1: StdCtrls.TEdit; >> end; > > IMO control classes have to be registered, so that a compiled application > can work independently from any namespace, unit or directory structure. > > That's why the first line above should read > Form1 = class(TForm) > where Form1 is the name of the form object, as stored in the object itself, > and TForm is the ClassName in the TForm.ClassType (vulgo VMT). > >> Why this? Well, we would not need to use prefixes in the names of our >> widgets. I could develop a widget called TEdit too, but using my own >> unit. > > All existing form objects are stored in Application.CustomForms[], and their > controls in Form.Controls. Likewise the class names are usable via RTTI. > Adding namespaces (or unit names) would require further table(s), that do > not yet exist (except perhaps in debug info).
Hi Hans, I'm not talk about RTTI but style, make code more readable and less duplication of names. Marcos Douglas -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
