[pascal]
type
TGameField = record
X,Y, MaxLen: Integer;
Text: String;
Font: TFont;
GotFocus, Password: Boolean;
end;

Function CurrField: TGameField;
var
i: Integer;
Fields: TFieldList;
begin

case GameState of
gsLogin: Fields:= TheLoginFields;
end;

for i := 0 to Length(Fields) - 1 do
begin
if Fields[i].GotFocus then Result:= Fields[i];
end;

end;

procedure FieldInput(input: Char);
begin
if Length(CurrField.Text) < Currfield.MaxLen then
CurrField.Text:= CurrField.Text+input;
end;
[/pascal]

Any ideas?

its supposed to write to the field found by CurrField.

for example:
TheLoginFields[0].GotFocus is True;
then i want to write to it.
how should i do this (with as little stress on cpu as possible)