Du musst Dir natürlich die Farben merken bevor Du ein Feld selektierst und beim verlassen wieder auf die Ursprungsfarbe setzen.
Delphi-Quellcode:
if (screen.ActiveControl is TCheckbox) then begin
fieldColorBackgroundBevorGetFocus:=(screen.ActiveControl as TCheckbox).color;
fieldColorTextBevorGetFocus:=(screen.ActiveControl as TCheckbox).font.color;
fieldNameBevorGetFocus:=screen.ActiveControl.name;
fieldFormNameBevorGetFocus:=screen.ActiveCustomForm.name;
(screen.ActiveControl as TCheckbox).color:=backColor;
(screen.ActiveControl as TCheckbox).font.color:=fontcolor;
end;
Und dann ca so etwas in der Art :
Delphi-Quellcode:
for i:=0 to screen.CustomFormCount-1 do begin
for j:=0 to screen.CustomForms[i].ComponentCount-1 do begin
if (screen.CustomForms[i].name = fieldFormNameBevorGetFocus) and
(screen.CustomForms[i].Components[j].name = fieldNameBevorGetFocus) then begin
if (screen.CustomForms[i].Components[j] is TEdit) then begin
(screen.CustomForms[i].Components[j] as TEdit).color:=fieldColorBackgroundBevorGetFocus;
(screen.CustomForms[i].Components[j] as TEdit).font.color:=fieldColorTextBevorGetFocus;
end;
Gruß Sven