<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 03/02/2020 13:17, Sven Barth via
fpc-pascal wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAFMUeB_tauHJrWm6P8NXe_ksSX7aN4Rn+6Ex5VodUY6t8KkaZA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="auto">
<div>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Howard Page-Clark via
fpc-pascal <<a
href="mailto:fpc-pascal@lists.freepascal.org"
moz-do-not-send="true">fpc-pascal@lists.freepascal.org</a>>
schrieb am Mo., 3. Feb. 2020, 11:22:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">FPC
3.0.4 compiles this code excerpt without a murmur:<br>
<br>
== code ==<br>
<br>
{$mode objfpc}{$H+}<br>
<br>
type<br>
<br>
TSheetInfo = record<br>
name: String;<br>
tab: String;<br>
title: String;<br>
kind: TSheetKind; // an enumeration<br>
color: TColor;<br>
end;<br>
<br>
TBaseSheet = class(TTabSheet)<br>
protected<br>
FSheetInfo: TSheetInfo;<br>
...<br>
public<br>
constructor Create(aComponent: TComponent;
aSheetInfo: TSheetInfo); <br>
virtual; reintroduce;<br>
...<br>
property SheetKind: TSheetKind read FSheetInfo.kind;
// <<<br>
end;<br>
<br>
TEntryGrid = class(TCustomStringGrid)<br>
private<br>
FParentSheet: TBaseSheet;<br>
...<br>
public<br>
constructor Create(AOwner: TComponent; aParentSheet:
TBaseSheet); <br>
reintroduce;<br>
...<br>
property SheetKind: TSheetKind read
FParentSheet.FSheetInfo.kind; // <<<br>
end;<br>
<br>
== code end ==<br>
<br>
However, more recent FPCs (and trunk) reject this at the
properties <br>
(marked above <<) with the error "Record or object
type expected".<br>
<br>
Is there a modeswitch or other wheeze that will get recent
FPCs to <br>
accept dotted notation when specifying property read and
write fields?<br>
</blockquote>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">This is simply not allowed for class fields.
That it was, was essentially a bug ( <a
href="https://wiki.freepascal.org/User_Changes_Trunk#Property_field_access_lists_no_longer_allows_classes"
moz-do-not-send="true">https://wiki.freepascal.org/User_Changes_Trunk#Property_field_access_lists_no_longer_allows_classes</a>
). </div>
<div dir="auto">Either use records or (TP style) objects or use
a getter. If you declare it as "inline" you can essentially
get the same code (with the added bonus that you can raise an
exception should the field be Nil). </div>
<div dir="auto"><br>
</div>
<div dir="auto">Regards, </div>
<div dir="auto">Sven <br>
</div>
</div>
</blockquote>
<p>Thanks for the reference and clarification.</p>
<p>Howard<br>
</p>
<blockquote type="cite"
cite="mid:CAFMUeB_tauHJrWm6P8NXe_ksSX7aN4Rn+6Ex5VodUY6t8KkaZA@mail.gmail.com">
<div dir="auto">
<div dir="auto">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-pascal maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a>
</pre>
</blockquote>
</body>
</html>