Is contructions like this that aren't available: type TRec = record Numero: Integer; Nome: String; end;
implementation {$R *.lfm} procedure ShowTRec(rec: TRec); begin ShowMessage(rec.Nome); end; procedure TForm1.Button1Click(Sender: TObject); begin ShowTRec((Numero: 1; Nome: 'Pascal')); end; In this constructions is that today is nice to use a function to create the TRec. 2012/2/24 Everton Vieira <tonvie...@gmail.com> > I was trying to make this construction: > > type > TRec = record > Numero: Integer; > Nome: String; > end; > > function mTRec(Numero: Integer; Nome: String): TRec; > > type > TTest = class > const Nomes: array[0..2] of TRec = (mTRec(1, 'everton'), mTRec(2, > 'murilo'), mTRec(3, 'vieira')); > end; > > implementation > > {$R *.lfm} > > function mTRec(Numero: Integer; Nome: String): TRec; > begin > Result.Numero := Numero; > Result.Nome := Nome; > end; > > { TForm1 } > > procedure TForm1.Button1Click(Sender: TObject); > var > i1: Integer; > begin > for i1 := 0 to Length(TTest.Nome) -1 do > ShowMessage(TTest.Nomes[i1].Nome); > end; > > Is there any how to do it? > > -- > Everton Vieira. > -- Everton Vieira.
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal