Hi Adreas,<div><br></div><div>I just tried, your method did not work as expected. It compiled ok, but didn't put the cursor at the end of the line as I wanted. However, assign CaretPos a new TPoint worked.</div><div><br></div><div>Regards,<br><br>
在 三, 1月 9, 2013 at 4:47 下午,Andreas Schneider <aksdb@gmx.de> 写道:<br>
<blockquote type="cite">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<style type="text/css">
body {font-family: "Segoe UI", Helvetica, arial, freesans, clean, sans-serif; font-size: 10pt; color: #000000; background-color: #ffffff}
</style>
<div style="font-size: 10pt; font-family:
Helvetica,arial,freesans,clean,sans-serif; color: rgb(34, 34, 34);
background-color: rgb(255, 255, 255); border: medium none;
line-height: 1.2;" data-md-original="Hi,<br><br>you
could also use the with-statement, that is pretty handy in such
cases:<br><br>```delphi<br><tt>with
Edit1.CaretPos
do</tt><tt><br></tt><tt>begin</tt><tt><br></tt><tt>
X :=
0;</tt><tt><br></tt><tt> Y
:=
0;</tt><tt><br></tt><tt>end;<br>```<br></tt><br><div
class="moz-cite-prefix">Best
Regards,<br>Andreas</div>" class="markdown-here-wrapper" id="markdown-here-wrapper-53346">
<p style="margin: 1em 0px;">Hi,
</p>
<p style="margin: 1em 0px;">you could also use the with-statement,
that is pretty handy in such cases:
</p>
<pre style="font-size: 0.85em; font-family: Consolas,Inconsolata,Courier,monospace;font-size: 1em; line-height: 1.2em; overflow: auto;margin: 1em 0px;"><code style="font-size: 0.85em; font-family: Consolas,Inconsolata,Courier,monospace;margin: 0px 0.15em; padding: 0px 0.3em; white-space: nowrap; border: 1px solid rgb(234, 234, 234); background-color: rgb(248, 248, 248); border-radius: 3px 3px 3px 3px; display: inline;white-space: pre; border-radius: 3px 3px 3px 3px; border: 1px solid rgb(204, 204, 204); padding: 0.5em 0.7em;display: block; padding: 0.5em; color: rgb(51, 51, 51); background: none repeat scroll 0% 0% rgb(248, 248, 255);" class="lang-delphi delphi"><span style="color: rgb(51, 51, 51); font-weight: bold;" class="keyword">with</span> Edit1.CaretPos <span style="color: rgb(51, 51, 51); font-weight: bold;" class="keyword">do</span>
<span style="color: rgb(51, 51, 51); font-weight: bold;" class="keyword">begin</span>
X := <span style="color: rgb(0, 153, 153);" class="number">0</span>;
Y := <span style="color: rgb(0, 153, 153);" class="number">0</span>;
<span style="color: rgb(51, 51, 51); font-weight: bold;" class="keyword">end</span>;</code></pre>
<p style="margin: 1em 0px;">Best Regards,<br>
Andreas</p>
</div>
<div class="moz-cite-prefix"><br>
On 08.01.2013 16:30, xrfang wrote:<br>
</div>
<blockquote class=" cite" id="mid_50ec3b97_6689440a_2a58_ffffa7c7_mx_google_com" cite="mid:50ec3b97.6689440a.2a58.ffffa7c7@mx.google.com" type="cite">Hi,
<div><br>
</div>
<div>Is there "record literal in FPC? e.g. normally, you do:</div>
<div><br>
</div>
<div>var</div>
<div> cp : TPoint;</div>
<div><br>
</div>
<div>cp.X := 0;</div>
<div>cp.Y := 0;</div>
<div>Edit1.CaretPos := cp;</div>
<div><br>
</div>
<div>I would like to use literal directly, such as:</div>
<div><br>
</div>
<div>Edit1.CaretPos := (X: 0, Y: 0); </div>
<div><br>
</div>
<div>But the above syntax is wrong. Is there such thing exists?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Shannon</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">--
_______________________________________________
Lazarus mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a>
</pre>
</blockquote>
<br>
</blockquote><br></div>