但是当我尝试使子对象的父对象与命名为master对象相同时,我得到了这个错误:
[DCC错误] mimik.pas(558):E2010不兼容的类型:'TWinControl'和'TControl'
我请求你的帮助。我将不胜感激。
Procedure bakimguncelle; // This is the procedure to refresh my main screen
var
i :integer;
f:Tcxgroupbox;
g:tcontrol;
begin
i:=0;
freeandnil(form1.ScrollBox1);
with TScrollbox.Create(Form1) do
begin
parent:=form1.takip;
name:='Scrollbox1';
align:=alclient;
end;
form1.ScrollBox1.CleanupInstance;
i:=0;
data.DataModule1.unite.First;
while not data.DataModule1.unite.eof do
begin
with Tcxgroupbox.Create(Form1) do // master objects created in scrollbox
begin
parent:=form1.ScrollBox1;
Name:='b'+data.DataModule1.uniteUniteId.AsString;
width:=parent.Width;
align:=altop;
height:=122;
g.Name:=name;
caption:=data.DataModule1.uniteAdi.Value;
style.LookAndFeel.NativeStyle:=false;
style.LookAndFeel.SkinName:='Silver';
visible:=true;
end;
data.DataModule1.makina.First;
while not data.DataModule1.makina.eof do
begin
with TScrollbox.Create(Form1) do //child objects are tried to be created in master
begin
parent:='b'+data.DataModule1.uniteUniteId.AsString;
Align:=altop;
name:='df'+inttostr(random(34247)); // just trial
randomize;
end;
data.DataModule1.makina.Next;
end;
data.DataModule1.unite.Next;
i:=i+1;
end;
end;