LCL: TCustomForm: autosize/updateshowing is now delayed till AfterConstruction, including DoCreate, bug #16290

git-svn-id: trunk@24700 -
This commit is contained in:
mattias 2010-04-18 17:31:58 +00:00
parent 188ae1249a
commit 49948f42f1

View File

@ -75,7 +75,9 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TCustomForm.AfterConstruction; procedure TCustomForm.AfterConstruction;
begin begin
//DebugLn(['TCustomForm.AfterConstruction ']);
DoCreate; DoCreate;
EndFormUpdate; // the BeginFormUpdate is in CreateNew
inherited AfterConstruction; inherited AfterConstruction;
end; end;
@ -1794,28 +1796,23 @@ begin
//DebugLn('[TCustomForm.Create] A Class=',Classname); //DebugLn('[TCustomForm.Create] A Class=',Classname);
GlobalNameSpace.BeginWrite; GlobalNameSpace.BeginWrite;
try try
BeginFormUpdate; CreateNew(AOwner, 1); // this calls BeginFormUpdate, which is ended in AfterConstruction
try //DebugLn('[TCustomForm.Create] B Class=',Classname);
CreateNew(AOwner, 1); if (ClassType <> TForm) and not (csDesigning in ComponentState) then
//DebugLn('[TCustomForm.Create] B Class=',Classname); begin
if (ClassType <> TForm) and not (csDesigning in ComponentState) then Include(FFormState, fsCreating);
begin try
Include(FFormState, fsCreating); //DebugLn('[TCustomForm.Create] C Class=',Classname);
try if not InitResourceComponent(Self, TForm) then begin
//DebugLn('[TCustomForm.Create] C Class=',Classname); //DebugLn('[TCustomForm.Create] Resource '''+ClassName+''' not found');
if not InitResourceComponent(Self, TForm) then begin //DebugLn('This is for information purposes only. This is not critical at this time.');
//DebugLn('[TCustomForm.Create] Resource '''+ClassName+''' not found'); // MG: Ignoring is best at the moment. (Delphi raises an exception.)
//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);
finally
Exclude(FFormState, fsCreating);
end; end;
//DebugLn('[TCustomForm.Create] D Class=',Classname);
//DebugLn('[TCustomForm.Create] E Class=',Classname);
finally
Exclude(FFormState, fsCreating);
end; end;
finally
EndFormUpdate;
end; end;
finally finally
GlobalNameSpace.EndWrite; GlobalNameSpace.EndWrite;
@ -1862,8 +1859,8 @@ begin
Color := clBtnFace; Color := clBtnFace;
FloatingDockSiteClass := TWinControlClass(ClassType); FloatingDockSiteClass := TWinControlClass(ClassType);
Screen.AddForm(Self); Screen.AddForm(Self);
EndFormUpdate;
FAllowDropFiles := False; FAllowDropFiles := False;
// the EndFormUpdate is done in AfterConstruction
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------