Hi,
das ganze jetzt mit einer Prozedur und mit Schleife:
Delphi-Quellcode:
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
var
loop: integer;
begin
if Key = #13 then
begin
Self.Perform(WM_NEXTDLGCTL, 0, 0);
for loop := 0 to Pred(self.ComponentCount) do
begin
if self.Components[loop] is TComboBox then
if TComboBox(self.Components[loop]).Focused then
TComboBox(self.Components[loop]).Color:= clRed
else
TComboBox(self.Components[loop]).Color:= clWindow;
if self.Components[loop] is TEdit then
if TEdit(self.Components[loop]).Focused then
TEdit(self.Components[loop]).Color:= clRed
else
TEdit(self.Components[loop]).Color:= clWindow;
end;
end;
end;