lcl: raise an exception if form resource is not found inside Create constructor. For resourceless forms CreateNew constructor must be used.

git-svn-id: trunk@29262 -
This commit is contained in:
paul 2011-01-31 03:39:06 +00:00
parent bfe85e683f
commit 8b2ec0ed64

View File

@ -1870,25 +1870,17 @@ end;
{------------------------------------------------------------------------------
TCustomForm Constructor
------------------------------------------------------------------------------}
constructor TCustomForm.Create(AOwner : TComponent);
constructor TCustomForm.Create(AOwner: TComponent);
begin
//DebugLn('[TCustomForm.Create] A Class=',Classname);
GlobalNameSpace.BeginWrite;
try
CreateNew(AOwner, 1); // this calls BeginFormUpdate, which is ended in AfterConstruction
//DebugLn('[TCustomForm.Create] B Class=',Classname);
if (ClassType <> TForm) and not (csDesigning in ComponentState) then
begin
Include(FFormState, fsCreating);
try
//DebugLn('[TCustomForm.Create] C Class=',Classname);
if not InitResourceComponent(Self, TForm) then begin
//DebugLn('[TCustomForm.Create] Resource '''+ClassName+''' not found');
//DebugLn('This is for information purposes only. This is not critical at this time.');
// MG: Ignoring is best at the moment. (Delphi raises an exception.)
end;
//DebugLn('[TCustomForm.Create] D Class=',Classname);
//DebugLn('[TCustomForm.Create] E Class=',Classname);
if not InitResourceComponent(Self, TForm) then
raise EResNotFound.CreateFmt(rsResourceNotFound, [ClassName]);
finally
Exclude(FFormState, fsCreating);
end;
@ -1896,7 +1888,6 @@ begin
finally
GlobalNameSpace.EndWrite;
end;
//DebugLn('[TCustomForm.Create] END Class=',Classname);
end;
{------------------------------------------------------------------------------