LCL: Allow overriding resource loading in TCustomForm. Issue #20358, patch from Anton Kavalenka.

git-svn-id: trunk@50911 -
This commit is contained in:
juha 2015-12-18 19:06:14 +00:00
parent 894c125543
commit 08f907306b
2 changed files with 12 additions and 6 deletions

View File

@ -557,6 +557,7 @@ type
procedure SetAutoScroll(Value: Boolean); override; procedure SetAutoScroll(Value: Boolean); override;
procedure DoAddActionList(List: TCustomActionList); procedure DoAddActionList(List: TCustomActionList);
procedure DoRemoveActionList(List: TCustomActionList); procedure DoRemoveActionList(List: TCustomActionList);
procedure ProcessResource;virtual;
protected protected
// drag and dock // drag and dock
procedure BeginAutoDrag; override; procedure BeginAutoDrag; override;

View File

@ -1966,12 +1966,7 @@ begin
begin begin
Include(FFormState, fsCreating); Include(FFormState, fsCreating);
try try
if not InitResourceComponent(Self, TForm) then ProcessResource;
if RequireDerivedFormResource then
raise EResNotFound.CreateFmt(
rsFormResourceSNotFoundForResourcelessFormsCreateNew, [ClassName])
else
DebugLn(Format(rsFormResourceSNotFoundForResourcelessFormsCreateNew, [ClassName]));
finally finally
Exclude(FFormState, fsCreating); Exclude(FFormState, fsCreating);
end; end;
@ -1981,6 +1976,16 @@ begin
end; end;
end; end;
procedure TCustomForm.ProcessResource;
begin
if not InitResourceComponent(Self, TForm) then
if RequireDerivedFormResource then
raise EResNotFound.CreateFmt(
rsFormResourceSNotFoundForResourcelessFormsCreateNew, [ClassName])
else
DebugLn(Format(rsFormResourceSNotFoundForResourcelessFormsCreateNew, [ClassName]));
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
constructor TCustomForm.CreateNew(AOwner: TComponent; Num : Integer); constructor TCustomForm.CreateNew(AOwner: TComponent; Num : Integer);
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}