[Lazarus] Class const of array of record.
Everton Vieira
tonvieira at gmail.com
Fri Feb 24 14:53:13 CET 2012
Worked, even better than i thought.
Many thanks!
2012/2/24 Adrian Veith <adrian at veith-system.de>
> try
>
> ((Numero:1; Nome'everton'), (Numero:2; Nome: 'murilo'), (Numero:3;
> Nome:'vieira'));
> Am 24.02.2012 14:28, schrieb Everton Vieira:
>
> 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.
>
>
> This body part will be downloaded on demand.
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
--
Everton Vieira.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120224/86db54df/attachment-0003.html>
More information about the Lazarus
mailing list