Results 1 to 3 of 3

Thread: Problems with records on delphi 7

  1. #1

    Problems with records on delphi 7

    System: Windows XP, P4 2 GHz
    Compiler/IDE: Delphi 7 for Win32
    API: Gl Scene
    -----

    Howdy back again, thought it would happen! I seem to have a problem getting record structure to work. As far as I can see the code is fine, but it keeps firing the record, object or class type required. But I have decarled the structure at the start. If you can the spot the error it will help me no end!

    ----
    type
    TDev1 = record
    Sizeof : integer;
    model :integer;
    tlx :integer;
    tly, blx, bly, trx, tryi, brx, bry :integer;
    end;
    TForm1 = class(TForm)
    .
    .
    .

    map: array [1..100,1..100] of TDev1;
    .
    .

    for l1:=1 to sizea do // y
    for l2:=2 to sizea do //x
    begin

    map.tlx[l2,l1] :=l2+a[l2-1,l1];
    map.tly[l2,l1] :=l1+maxy ;

    map.trx[l2,l1] :=l2+(a[l2,l1]+a[l2-1,l1]);
    map.tryi[l2,l1] :=l1+maxy;

    map.blx[l2,l1] :=l2+a[l2-1,l1];
    map.bly[l2,l1] :=l1+maxy+a[l2,l1];

    map.brx[l2,l1] :=trx[l2,l1];
    map.bry[l2,l1] :=l1+maxy+a[l2,l1];

    end;

    -----

    Far as I can see that should work as I have decared the structure and referenced it correctly...Seriously any help would be apreciated as it is extremely fustrating!

    Thanks
    Whitt

  2. #2

    Problems with records on delphi 7

    These aren't arrays:
    [pascal]
    tlx :integer;
    tly, blx, bly, trx, tryi, brx, bry :integer;
    [/pascal]

    Yet you try to make arrays out of them by this:
    [pascal]
    map.tlx[l2,l1] :=l2+a[l2-1,l1];
    [/pascal]

  3. #3

    Problems with records on delphi 7

    I see, do you have to decare these as arrays even if the record is a array in itself....

    I just tried that but it didn't work gave me the same error.
    James

    EDIT: I'm a idiot, I put the square brackets in the wrong place......Duh... Thanks for the help anyway!!

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
  •