<p style="padding:0 0 0 0; margin:0 0 0 0;">Hi,</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">some crippled formatting, so again:</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">However, in your case (records) I would rather use TFPGList from FGL unit:</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">1) add {$modeswitch ADVANCEDRECORDS}</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<div style="font-size: 13.3333px;"><span style="font-size: 10pt;">2) add FGL to uses</span></div>
<div style="font-size: 13.3333px;"><span style="font-size: 10pt;"><br />
</span></div>
<div style="font-size: 13.3333px;"><span style="font-size: 10pt;">3) define class operator =</span></div>
<div style="font-size: 13.3333px;"><span style="font-size: 10pt;"><br />
</span></div>
<div style="font-size: 13.3333px;">
<div>test = record</div>
<div> Port :String;</div>
<div> Size :Byte;</div>
<div> Status :Word;</div>
<div> class operator = (A,B: test): Boolean;</div>
<div> End; </div>
<div>4) implement it</div>
<div>
<div>class operator test.=(A, B: test): Boolean;</div>
<div><span style="font-size: 13.3333px;">begin</span></div>
<div><span style="font-size: 13.3333px;"> Result:=(A.Port=B.Port) and (A.Size=B.Size); // and ...</span></div>
<div><span style="font-size: 13.3333px;">end; </span></div>
</div>
</div>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">5) define specialized list:</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> TMyL = specialize TFPGList<test>;</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">6) create it</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> MyList: TMyL;</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> ...</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> MyList:=TMyL.Create;</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">Now you can work with it comfortably</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">MyList[1].Port:='abc';</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">V.</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">______________________________________________________________<br />
> Od: "Vojtěch Čihák via fpc-pascal" <fpc-pascal@lists.freepascal.org><br />
> Komu: james@productionautomation.net, "FPC-Pascal users discussions" <fpc-pascal@lists.freepascal.org><br />
> Datum: 08.09.2020 16:21<br />
> Předmět: Re: [fpc-pascal] TFPObjectlist example<br />
></p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">______________________________________________________________<br />
> Od: "James Richters via fpc-pascal" <fpc-pascal@lists.freepascal.org><br />
> Komu: "'FPC-Pascal users discussions'" <fpc-pascal@lists.freepascal.org><br />
> Datum: 07.09.2020 01:08<br />
> Předmět: [fpc-pascal] TFPObjectlist example<br />
></p>
<br />
James<br />
<br />
_______________________________________________<br />
fpc-pascal maillist - fpc-pascal@lists.freepascal.org<br />
<a href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a><br />
<br />
<br />
----------<br />
<br />
_______________________________________________<br />
fpc-pascal maillist - fpc-pascal@lists.freepascal.org<br />
<a href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a><br />