我在表单上有组件并寻找任何TMachine
类型然后一旦我找到一个我想从组件中获取一些信息。我的问题是:我声明m
为TMachine
然后尝试分配m := Components[i]
但不会让我因为m
是 TMachine 类型和组件是组件类型。有关如何解决此问题的任何帮助,以便我可以将找到的组件用作 TMachine?
procedure TfDeptLayout.bSaveClick(Sender: TObject);
var
i: Integer;
m : TMachine;
Number,Zone,Dept,Name,Asset,IsPanel,BasicName,FinalLocation,Left,Top : String;
begin
bSave.Visible := false;
for i := ComponentCount -1 downto 0 do
begin
if(Components[I] is TMachine) then
begin
M := Components[I];
Number := m.mnNumber;
Name := m.mnName;
Asset := m.mnAsset;
IsPanel := m.mnIsPanel;
BasicName := m.mnBasicName;
if checkbox1.Checked then
FinalLocation := 'shop'
else
FinalLocation := 'w';
Left := inttostr(m.Left);
top := inttostr(m.Top);
Zone := myZone;
Dept := myDept;
Showmessage('Zone: '+Zone+' Dept: '+Dept
+'Name : '+Name+' Number: '+Number+' Asset: '+Asset
+'IsPanel: '+Ispanel+' BasicName: '+BasicName+
' FinalLocation : '+FinalLocation+' Left: '+Left+
+' Top: '+Top);
end;
end;