<div dir="ltr">2011/12/25 Jiří Pavlovský <span dir="ltr"><<a href="mailto:jira@getnet.cz">jira@getnet.cz</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
how can I create two level map where value is array of records? These records are constant - I don't need to compute them or anything.<br>
I'm quite new to pascal and for gods sake cannot figure it out. I tried to use TFPGMap for that.<br>
<br>
I mean somewhere in the code I get two values and based on these I need to get those records.<br>
<br>
my dream would be something like<br>
myArrayOfRecords := myMap[some_value][other_value]<u></u>;<br></blockquote><div><br>type<br> TMyRec = record<br> Field : integer;<br> Empty,<br> Check : Boolean;<br> end;<br><br> TMyMap = array[0..Something] of TMyRec;<br>
</div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
I even tried to write a function that would return array of records based on its parameters, but that does not work either.<br>
I cannot figure out how to assign the record.<br>
<br>
This causes a compile error:<br>
res[0] := (Field: 1; Empty: true; Check: false);<br></blockquote><div><br> res[0].Field := 1;<br> res[0].Empty := true;<br> res[0].Check := false;<br><br>if you want to make it as a function:<br><br>function ToMyRec (AField : Integer; AEmpty, ACheck : Boolean) : TMyRec;<br>
begin<br> Result.Field := AFiled;<br> Result.Empty := AEmpty;<br> Result.Check := AChek;<br>end;<br><br>res[0] := ToMyRec(...);<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
OTOH similar construct works in "const" section. So I'm quite puzzled.<br></blockquote><div><br>What do you mean ?<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
Thank you<br>
______________________________<u></u>_________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank">fpc-pascal@lists.freepascal.<u></u>org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/<u></u>mailman/listinfo/fpc-pascal</a><br>
</blockquote></div><br></div>