MG: fixed streaming visible=false

git-svn-id: trunk@3299 -
This commit is contained in:
lazarus 2002-09-08 10:01:59 +00:00
parent cab2573590
commit a188d432fd
2 changed files with 43 additions and 15 deletions

View File

@ -305,10 +305,29 @@ end;
function TJITForms.AddJITFormFromStream(BinStream:TStream):integer;
// returns new index
// -1 = invalid stream
procedure ApplyVisible;
var
i: integer;
AControl: TControl;
begin
// The LCL has as default Visible=false. But for Delphi compatbility
// loading control defaults to true.
for i:=0 to FCurReadForm.ComponentCount-1 do begin
AControl:=TControl(FCurReadForm.Components[i]);
if (AControl is TControl) then begin
if (not (csVisibleSetInLoading in AControl.ControlState)) then
AControl.Visible:=true
else
AControl.ControlState:=
AControl.ControlState-[csVisibleSetInLoading];
end;
end;
end;
var
Reader:TReader;
NewClassName:shortstring;
a:integer;
NewName: string;
begin
Result:=-1;
@ -361,12 +380,7 @@ begin
{$IFDEF IDE_VERBOSE}
writeln('[TJITForms.AddJITFormFromStream] 5');
{$ENDIF}
// MG: workaround til visible=true is default
for a:=0 to FCurReadForm.ComponentCount-1 do begin
if FCurReadForm.Components[a] is TControl then
TControl(FCurReadForm.Components[a]).Visible:=true;
end;
// MG: end of workaround
ApplyVisible;
{$IFDEF IDE_VERBOSE}
writeln('[TJITForms.AddJITFormFromStream] 6');

View File

@ -415,10 +415,30 @@ function InitResourceComponent(Instance: TComponent;
RootAncestor: TClass):Boolean;
function InitComponent(ClassType: TClass): Boolean;
procedure ApplyVisible;
var
i: integer;
AControl: TControl;
begin
// The LCL has as default Visible=false. But for Delphi compatbility
// loading control defaults to true.
if Instance is TControl then
for i:=0 to Instance.ComponentCount-1 do begin
AControl:=TControl(Instance.Components[i]);
if (AControl is TControl) then begin
if (not (csVisibleSetInLoading in AControl.ControlState)) then
AControl.Visible:=true
else
AControl.ControlState:=
AControl.ControlState-[csVisibleSetInLoading];
end;
end;
end;
var
CompResource:TLResource;
MemStream: TMemoryStream;
a:integer;
begin
//writeln('[InitComponent] ',ClassType.Classname,' ',Instance<>nil);
Result:=false;
@ -444,13 +464,7 @@ function InitResourceComponent(Instance: TComponent;
end;
end;
finally
// MG: workaround til Visible=true is default
if Instance is TControl then
for a:=0 to Instance.ComponentCount-1 do
if Instance.Components[a] is TControl then begin
TControl(Instance.Components[a]).Visible:=true;
end;
// MG end of workaround
ApplyVisible;
MemStream.Free;
end;
Result:=true;