Ich benötige 2x den exakt gleichen Text in der Checkbox und in Form2.OnShow, damit beim starten die Einstellungen übernommen werden.
Gibt es da ne Möglichkeit/ nenn Befehl, dass ich das ganze nur einmal schreiben muss.
Delphi-Quellcode:
procedure TForm2.CheckBox15Click(Sender: TObject);
begin
if Form2.checkbox15.Checked then
begin
Form2.blau.Enabled:=True;
Form2.pink.Enabled:=True;
Form2.E12z.Enabled:=True;
Form2.blau.Color:=clWindow;
Form2.pink.Color:=clWindow;
Form2.E12z.Color:=clWindow;
begin
If (E12Z.ItemIndex = 1)
Or (E12Z.ItemIndex = 3)
Or (E12Z.ItemIndex = 4)
Or (E12Z.ItemIndex = 5) Then
Begin
A12Z.Enabled:=False;
A12Z.Color:=cl3DLight;
end else
begin
A12Z.Enabled:=True;
A12Z.Color:=clWindow;
end;
end;
end else
begin
Form2.blau.Enabled:=False;
Form2.pink.Enabled:=False;
Form2.E12z.Enabled:=False;
Form2.A12z.Enabled:=False;
Form2.blau.Color:=cl3DLight;
Form2.pink.Color:=cl3DLight;
Form2.E12z.Color:=cl3DLight;
Form2.A12z.Color:=cl3DLight;
end;
end;
Delphi-Quellcode:
procedure TForm2.FormShow(Sender: TObject);
begin
if Form2.checkbox15.Checked then
begin
Form2.blau.Enabled:=True;
Form2.pink.Enabled:=True;
Form2.E12z.Enabled:=True;
Form2.blau.Color:=clWindow;
Form2.pink.Color:=clWindow;
Form2.E12z.Color:=clWindow;
begin
If (E12Z.ItemIndex = 1)
Or (E12Z.ItemIndex = 3)
Or (E12Z.ItemIndex = 4)
Or (E12Z.ItemIndex = 5) Then
Begin
A12Z.Enabled:=False;
A12Z.Color:=cl3DLight;
end else
begin
A12Z.Enabled:=True;
A12Z.Color:=clWindow;
end;
end;
end else
begin
Form2.blau.Enabled:=False;
Form2.pink.Enabled:=False;
Form2.E12z.Enabled:=False;
Form2.A12z.Enabled:=False;
Form2.blau.Color:=cl3DLight;
Form2.pink.Color:=cl3DLight;
Form2.E12z.Color:=cl3DLight;
Form2.A12z.Color:=cl3DLight;
end;
end;