Say that I have three switches, namely SW_A, SW_B, and SW_ALL.
When SW_A is clicked (from off to on), TMemo prints 'SW_A is on', and the same works for SW_B.
However, when SW_ALL is clicked(from off to on), TMemo prints 'SW_ALL is on', and SW_A and SW_B should both be turned on no matter what their current states were without printing 'SW_A is on' and 'SW_B is on.'
My problem is that whenever SW_All is clicked, other switches also prints their states out. Does anyone know how to solve the problem? Thanks!!
procedure TForm1.SW_ALLSwitch(Sender: TObject);
begin
if SW_All.IsChecked then
begin
Memo1.Lines.Add('SW_All is on');
SW_Alarm_A.IsChecked := True;
SW_Alarm_B.IsChecked := True;
end
else
begin
Memo1.Lines.Add('SW_All is off');
SW_Alarm_A.IsChecked := False;
SW_Alarm_B.IsChecked := False;
end;
end;
procedure TForm1.SW_ASwitch(Sender: TObject);
begin
if SW_A.IsChecked = False then
Memo1.Lines.Add('SW_A is off')
else
Memo1.Lines.Add('SW_A is on');
end;