Hi,

I'm following a suggestion for producing my own records
so that I can define a custom TStringlist as detailed in this
article:
http://dn.codegear.com/article/33423

However, I am unsure of where to post this code and am
wondering if someone would advise me.
=================== snip =======================
unit mvlists;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils;

type
  TNameValueRecord = record
  private
    FNames: array of string;
    FTypes: array of string;
    function  GetCount: integer; inline;
    function  GetItem(index: integer): string;
    procedure SetItem(index: integer; const Value: string);
  public
    function  Add(const line: string): integer;
    procedure Clear;
    function  IndexOf(const s: string): integer;
    function  ValueOf(const s: string): integer;
    property  Count: integer read GetCount;
    property  Items[index: integer]: string read GetItem write SetItem; default;
  end;

implementation

function TNameValueRecord.Add(const nm, line: string): integer;
begin
  SetLength(FNames,Count+1);
  SetLength(FTypes,Count+1);
  FNames[Count-1] := line;
  FTypes[Count-1] := line;
  result := Count - 1;
end;
procedure TNameValueRecord.Clear;
begin
  SetLength( FNames, 0 );
  SetLength( FTypes, 0 );
.......
=================== snip =======================

I get this error:
mvlists.pas(13,5) Fatal: Syntax error, ":" expected but "identifier
FNAMES" found

So I am clearly placing this code in the wrong section.
_______________________________________________
Lazarus mailing list
[email protected]
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to