[Lazarus] A change in LCL require your TCustomForm descendants to have a resource or to use a CreateNew constructor
michael.vancanneyt at wisa.be
michael.vancanneyt at wisa.be
Wed Feb 2 15:48:49 CET 2011
On Wed, 2 Feb 2011, Mattias Gaertner wrote:
>
>
>
> michael.vancanneyt at wisa.be hat am 2. Februar 2011 um 11:49 geschrieben:
>
>>
>>
>> On Wed, 2 Feb 2011, Paul Ishenin wrote:
>>
>>> Hello, Lazarus mailing list.
>>>
>>> I've changed the behavior of TCustomForm.Create constructor. Now it raises
>>> an
>>> exception if your TCustomForm descendant has no resource.
>>>
>>>
>>> The behavior is controlled by a global variable *RequireDerivedFormResource*
>>> which is set to True for all new applications created by the IDE and is set
>>> to False by default. If you for some reason want the old behavior just
>>> remove
>>> "RequireDerivedFormResource := True" line from .lpr file of your new
>>> application.
>>
>> I think you should do the opposite: The default should be 'True', and users
>> should disable this explicitly.
> This would break existing projects without need.
I did some tests. For a TDatamodule descendant, TMyDataModule.Create(Nil)
gives an error if there is no resource. For a form, the form remains empty.
I knew about the former, and had assumed the form would react the same as TDataModule.
It does not, apparently.
>> That would also be Delphi compatible.
> That's why it is enabled for new projects. Don't forget this is just a warning
> that something might be missing. It is not a necessary bug fix.
Indeed.
>> There is one caveat: The TForm class itself should not search for a resource,
>> only TForm Descendants should do this.
> Huh?
> That was always so.
I was just remarking on the possibility, in case it was missed.
Michael.
More information about the Lazarus
mailing list