Results 1 to 3 of 3

Thread: Left side cannot be assigned to!

  1. #1

    Left side cannot be assigned to!

    [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)

  2. #2

    Left side cannot be assigned to!

    Changing to
    [pascal]Function CurrField: PGameField; [/pascal]
    and taking address of rect inside function should work.
    There are only 10 types of people in this world; those who understand binary and those who don't.

  3. #3

    Left side cannot be assigned to!

    hmm.. i dont understand what u just wrote, but i found a solution to my problem:

    [pascal]
    procedure FieldInput(input: Char);
    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
    begin
    if Length(Fields[i].Text) < Fields[i].MaxLen then
    Fields[i].Text:= Fields[i].Text+input;
    end;
    Exit;
    end;
    end;
    [/pascal]
    no need to make it more complicated than needed...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •