Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-10

ComponentEditors.pas: editor form procedures should work with TForm

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jesus Reyes
to Alexander Klenin

--- El vie 8-oct-10, Alexander Klenin escribi?:

Show quoted text 18 lines
De: Alexander Klenin Asunto: [Lazarus] ComponentEditors.pas: editor form procedures should work with TForm A: "Lazarus mailing list" Fecha: viernes, 8 de octubre de 2010, 6:43 I did a review of changes made by Jesus to fix http://bugs.freepascal.org/view.php?id=17572 and http://bugs.freepascal.org/view.php?id=17077 (Thanks again, btw, this was a messy problem) I think that FindEditorForm, RegisterEditorForm and UnregisterEditorForm should take/return editor as TForm instead of TObject, on the principle that strong typing is better than weak one. -- Alexander S. Klenin

It was made the way it is by considering at least three things, one, most times there will be a type cast to the new TForm class is being used to create an instance and the component or property editor is well aware of the right class to be used, two, FindEditorForm allows access to other component or property editors forms, and the more isolated are they the better.

At the same time it opens the door to other kinds of 'form' editors which are not descendants of forms. Btw, what if somebody uses TCustomForm as parent class instead of TForm?, So the way was planned accounted also flexibility.

Jesus Reyes A.

Reply by email

Mattias Gaertner
to Jesus Reyes
[...] It was made the way it is by considering at least three things, one, most times there will be a type cast to the new TForm class is being used to create an instance and the component or property editor is well aware of the right class to be used, two, FindEditorForm allows access to other component or property editors forms, and the more isolated are they the better. At the same time it opens the door to other kinds of 'form' editors which are not descendants of forms. Btw, what if somebody uses TCustomForm as parent class instead of TForm?, So the way was planned accounted also flexibility.

Since 0.9.27 a designer form can be anything descending from TComponent. That means, in FindEditorForm TObject can be changed to TComponent, although that does not raise much type safety.

Mattias

Reply by email