📄 harmware.pas
字号:
if((Sender as TFlatCheckBox).Checked) then
for i:=1 to CountVale do
CE_Valve[i].CheckBox.Checked := true
else
for i:=1 to CountVale do
CE_Valve[i].CheckBox.Checked := false;
end;
1:begin
if((Sender as TFlatCheckBox).Checked) then
for i:=1 to CountElect do
CE_Electry[i].CheckBox.Checked := true
else
for i:=1 to CountElect do
CE_Electry[i].CheckBox.Checked := false;
end;
2:begin
if((Sender as TFlatCheckBox).Checked) then
for i:=1 to CountDelay do
CE_DelayTime[i].CheckBox.Checked := true
else
for i:=1 to CountDelay do
CE_DelayTime[i].CheckBox.Checked := false;
end;
3:begin
if((Sender as TFlatCheckBox).Checked) then
for i:=1 to CountVoltCurr do
CE_VolCurr[i].CheckBox.Checked := true
else
for i:=1 to CountVoltCurr do
CE_VolCurr[i].CheckBox.Checked := false;
end;
5:begin
if((Sender as TFlatCheckBox).Checked) then
for i:=1 to CountBreak do
CE_Break[i].CheckBox.Checked := true
else
for i:=1 to CountBreak do
CE_Break[i].CheckBox.Checked := false;
end;
6:begin
if((Sender as TFlatCheckBox).Checked) then
for i:=1 to CountEvent do
CE_EventTime[i].CheckBox.Checked := true
else
for i:=1 to CountEvent do
CE_EventTime[i].CheckBox.Checked := false;
end;
8:begin
if((Sender as TFlatCheckBox).Checked) then
for i:=1 to CountOther do
CE_Others[i].CheckBox.Checked := true
else
for i:=1 to CountOther do
CE_Others[i].CheckBox.Checked := false;
end;
end;
end;
//-----------------------------------------------------------------------------------
procedure THarmForm.TV_BreadPosClick(Sender: TObject);
var
Node ,ParentNode: TTreeNode;
Name ,ParentName ,PPName,TmpMarkCode:string;
Index ,Level ,p,i:byte;
begin
inherited;
Node := TV_BreadPos.Selected;
Level := Node.Level;
if (Level=2) then
begin
Name := Node.Text;
ParentNode := Node.Parent;
ParentName := ParentNode.Text;
FE_BreadPosTitle.Caption:= ParentName + ParentNode.Parent.Text;
if(Name=Zero) then
begin
Index := 0;
for i:=0 to 9 do
LB_BreadPos[i+1].Caption := IntToStr(i);
end
else if(Name=First) then
begin
Index := 1;
for i:=10 to 19 do
LB_BreadPos[i-9].Caption := IntToStr(i);
end
else if(Name=Second) then
begin
Index := 2;
for i:=20 to 29 do
LB_BreadPos[i-19].Caption := IntToStr(i);
end
else if(Name=Third) then
begin
Index := 3;
for i:=30 to 39 do
LB_BreadPos[i-29].Caption := IntToStr(i);
end
else begin
Index := 4;
for i:=40 to 49 do
LB_BreadPos[i-39].Caption := IntToStr(i);
end;
p := pos('(',ParentName);
TmpMarkCode := copy(ParentName,p+1,4);
FMarkCode := IntToHex(StrToInt('$'+TmpMarkCode)+Index,4);
end;
end;
//-----------------------------------------------------------------------------------
procedure THarmForm.TV_EventClick(Sender: TObject);
var
Node ,Parent: TTreeNode;
Name ,ParentName ,TmpMarkCode:string;
Index ,Level ,p1,p2:byte;
begin
inherited;
Node := TV_Event.Selected;
Level := Node.Level;
Name := Node.Text;
p1 := pos('(',Name);
if (p1=0) then
exit;
FMarkCode := copy(Name,p1+1,4);
if(Level=0) then
begin
p1 := pos('(',Name);
p2 := pos(')',Name);
FE_ItemName.Text := Name;
Label_ValName.Caption := copy(Name,p1+2,p2-p1-2);
end
else begin
Parent := Node.Parent;
ParentName := Parent.Text;
p1 := pos('(',ParentName);
p2 := pos(')',ParentName);
FE_ItemName.Text := Name+ParentName;
Label_ValName.Caption := copy(ParentName,p1+2,p2-p1-2);
end;
end;
//-----------------------------------------------------------------------------------
procedure THarmForm.FSB_StopClick(Sender: TObject);
begin
inherited;
PostMessage(handle,WM_STOPREAD,0,0);
end;
//-----------------------------------------------------------------------------------
procedure THarmForm.FSB_StopMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
inherited;
Screen.Cursor := crDefault;
end;
//-----------------------------------------------------------------------------------
procedure THarmForm.FlatPanel1MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
inherited;
FlatPanel1.Cursor := crDefault;
end;
//-----------------------------------------------------------------------------------
procedure THarmForm.FEB_WriteClick(Sender: TObject);
var
i :byte;
begin
inherited;
FSB_Stop.Enabled := true;
FEB_Read.Enabled := false;
FEB_write.Enabled := false;
case PageIndex of
0:for i:=1 to CountVale do
if(CE_Valve[i].CheckBox.Checked) then
if(CE_Valve[i].Text='') then
begin
Application.MessageBox('设置数据不能为空!','系统信息',MB_ICONSTOP);
CE_Valve[i].SetFocus;
PostMessage(handle,WM_STOPREAD,0,0);
exit;
end
else begin
try
StrToInt(Trim(CE_Valve[i].Text));
except
Application.MessageBox('设置数据只能为整数!','系统信息',MB_ICONSTOP);
CE_Valve[i].SetFocus;
CE_Valve[i].Text := '';
PostMessage(handle,WM_STOPREAD,0,0);
exit;
end;
end;
2:for i:=1 to CountDelay do
if(CE_DelayTime[i].CheckBox.Checked) then
if(CE_DelayTime[i].Text='') then
begin
Application.MessageBox('设置数据不能为空!','系统信息',MB_ICONSTOP);
CE_DelayTime[i].SetFocus;
PostMessage(handle,WM_STOPREAD,0,0);
exit;
end
else begin
try
StrToInt(Trim(CE_DelayTime[i].Text));
except
Application.MessageBox('设置数据只能为整数!','系统信息',MB_ICONSTOP);
CE_DelayTime[i].SetFocus;
CE_DelayTime[i].Text := '';
PostMessage(handle,WM_STOPREAD,0,0);
exit;
end;
end;
{ 8:for i:=1 to CountOther-1 do
if(CE_Others[i].CheckBox.Checked) then
if (CE_Others[i].Text='') then
begin
Application.MessageBox('设置数据不能为空!','系统信息',MB_ICONSTOP);
CE_Others[i].SetFocus;
PostMessage(handle,WM_STOPREAD,0,0);
exit;
end
else begin
try
StrToInt(Trim(CE_Others[i].Text));
except
Application.MessageBox('设置数据只能为整数!','系统信息',MB_ICONSTOP);
CE_Others[i].SetFocus;
CE_Others[i].Text := '';
PostMessage(handle,WM_STOPREAD,0,0);
exit;
end;
end; }
end;//case
ControlIndex := 1;
FReadFlag := false;
PostMessage(Handle,WM_STARTREAD,PageIndex,ControlIndex);
end;
//-----------------------------------------------------------------------------------
procedure THarmForm.FCB_SunSelectAllClick(Sender: TObject);
var
i : byte;
begin
inherited;
if(FCB_SunSelectAll.Checked) then
for i:=1 to 45 do
CB_BurthMode2[i].Checked := true
else
for i:=1 to 45 do
CB_BurthMode2[i].Checked := false;
ChEdit_BurthMode2.Text := GetBurthenMode2();
end;
procedure THarmForm.CB_Byte3Change(Sender: TObject);
var
str:string;
i:byte;
begin
inherited;
for i:= 1 to 4 do
if (FCB_MeterMode[i].ItemIndex<0) then
exit;
str := IntToHex((FCB_MeterMode[1].ItemIndex+FCB_MeterMode[2].ItemIndex*2
+FCB_MeterMode[3].ItemIndex*4 +FCB_MeterMode[4].ItemIndex*8),2);
ChEdit_DSP.Text := str;
end;
Function HexToFloat(HexStr : string):single;
//16进制表示的符合IEEE标准的浮点数转换
var
Data: array[1..3] of Byte;
i : byte;
begin
for i:=1 to 4 do
begin
try
Data[i] := StrToInt('$'+ copy(HexStr,7-(i-1)*2,2));
except
Result := 0.0;
exit;
end;
end;
Result := PSingle(@Data)^;
end;
Function THarmForm.GetBurthenMode2(): string;
var
TmpStr, High: string;
TmpInt : Extended;
tmp ,i,j: integer;
begin
result := '';
TmpStr := '';
if(FCB_SunSelectAll.Checked) then
Result := 'FFFFFFFFFFFF'
else begin
for i:=1 to 6 do
begin
TmpInt := 0;
for j:=1 to 8 do
if(CB_BurthMode2[(i-1)*8+j].Checked) then
TmpInt := TmpInt + Power(2,j-1);
tmp:=Round(TmpInt);
High := IntToHex(tmp,2);
// High := copy(High,2,1)+ copy(High,1,1);
TmpStr := TmpStr + High;
end;
Result := TmpStr;
end;
end;
procedure THarmForm.FlatCheckBox1Click(Sender: TObject);
begin
inherited;
ChEdit_BurthMode2.Text := GetBurthenMode2();
end;
procedure THarmForm.TV_BreadPosChange(Sender: TObject; Node: TTreeNode);
var
i: byte;
begin
inherited;
for i:=1 to CountBreadPos do
CE_Break[i].text := '';
end;
procedure THarmForm.TV_EventChange(Sender: TObject; Node: TTreeNode);
var
i: byte;
begin
inherited;
for i:=1 to CountEvent do
begin
CE_EventTime[i].Text := '';
FE_Value1[i].Text := '';
end;
end;
procedure THarmForm.RichEditDblClick(Sender: TObject);
begin
inherited;
RichEdit.Clear;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -