procedure TMotorControl.initaliseMtr(Sender: Tobject; Count: Integer);
var ContPan: TPanel;
Start,Stop,Reset,Mpars: TBitBtn;
IGauge,Status,Fault: TEdit;
oldmotor: TComponent;
begin
{Create motors as required}
oldmotor := Findcomponent('Motor'+inttostr(count));
oldmotor.free;
Motor:= Tpanel.Create(MotorControl);
with motor do
begin
name := 'Motor'+inttostr(count);
Enabled := False;
Parent := MotorControl;
Width := 186;
Height := 113;
Top := 27 + Mx;
Left := 10 + My;
Caption := '';
end;
inc(My,198);
if My > 600 then
begin
My := 0;
inc(Mx,121);
end;
ContPan:=TPanel.Create(Motor);
with contPan do
begin
Parent := motor;
name := 'contpan' + inttostr(count);
Caption := '';
Height := 48;
Width := 175;
Top := 60;
Left := 5;
end;
Start:=TBitBtn.Create(ContPan);
with Start do
begin
Parent := ContPan;
Height := 20;
Width := 54;
Top := 3;
Left := 5;
// Glyph.loadfromfile(working + '\start.bmp');
Buttons.GetBitmap(0,Glyph);
Tag := count;
OnClick := Start2Click;
end;
Stop := TBitBtn.Create(ContPan);
with Stop do
begin
Parent := ContPan;
Height := 20;
Width := 54;
Top := 3;
Left := 60;
Buttons.GetBitmap(1,Glyph);
// Glyph.loadfromfile(working +'\stop.bmp');
Tag := count;
OnClick := Stop2Click;
end;
Reset:=TBitBtn.Create(ContPan);
with Reset do
begin
Parent := ContPan;
Height := 20;
Width := 54;
Top := 3;
Left := 115;
Buttons.GetBitmap(2,Glyph);
// Glyph.loadfromfile(working +'\reset.bmp');
Tag := count;
OnClick := Reset2Click;
end;
Mpars:=TBitBtn.Create(Motor);
Mpars.Parent := Motor;
Mpars.Name := 'Mpars' + IntToStr(count);
Mpars.Height := 54;
Mpars.Width := 175;
Mpars.Top := 5;
Mpars.Left := 5;
MotorImages.GetBitmap(1, Mpars.Glyph);
//Mpars.Glyph.loadfromfile(working +'\mtrstop.bmp');
Mpars.Caption := 'Motor '+inttostr(count);
Mpars.Tag := count;
Mpars.OnClick := EditParametersClick;
IGauge := Tedit.Create(ContPan);
IGauge.Parent := ContPan;
IGauge.Name := 'Igauge' + IntToStr(Count);
IGauge.borderstyle := bsSingle;
IGauge.Height := 17;
IGauge.Width := 53;
IGauge.Top := 25;
IGauge.Left := 5;
Igauge.autosize := false;
IGauge.ReadOnly := True;
IGauge.Font.name := 'courier';
IGauge.Font.size := 10;
Status := Tedit.Create(ContPan);
Status.Parent := ContPan;
Status.Name := 'Status' + IntToStr(Count);
Status.Font.name := 'courier';
Status.Font.size := 10;
Status.Height := 17;
Status.Width := 53;
Status.Top := 25;
Status.Left := 60;
Status.ReadOnly := True;
Fault := Tedit.Create(ContPan);
Fault.Parent := ContPan;
Fault.Name := 'Fault' + IntToStr(count);
Fault.Font.name := 'courier';
Fault.Font.size := 10;
Fault.Height := 17;
Fault.Width := 53;
Fault.Top := 25;
Fault.Left := 115;
Fault.ReadOnly := True;
end;