[Lazarus] record literal in FPC?

Andreas Schneider aksdb at gmx.de
Wed Jan 9 13:27:50 CET 2013


Interesting. IIRC that worked correctly in Delphi 2010 (it's been a
while ...). This /might /be a bug in FPC.

The root of the problem is how properties are handled. Afaics however,
the use of /with/ should cause it to assign the final record afterwards.
Apparently it doesn't - at least not always. Could be by design, could
be a bug. I'll check the bug tracker later and may report that. (You can
do that yourself, if you want, but sooner or later I would like that
functionality to work too, so I've a personal interest in this and
therefore would not mind to report it :-))

Greetings,
Andreas


On 09.01.2013 13:19, xrfang wrote:
> Hi Adreas,
>
> 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.
>
> Regards,
>
> ? ?, 1? 9, 2013 at 4:47 ??,Andreas Schneider <aksdb at gmx.de> ??:
>>
>> Hi,
>>
>> you could also use the with-statement, that is pretty handy in such
>> cases:
>>
>> |with Edit1.CaretPos do
>> begin
>>   X := 0;
>>   Y := 0;
>> end;|
>>
>> Best Regards,
>> Andreas
>>
>>
>> On 08.01.2013 16:30, xrfang wrote:
>>> Hi, 
>>>
>>> Is there "record literal in FPC? e.g. normally, you do:
>>>
>>> var
>>>    cp : TPoint;
>>>
>>> cp.X := 0;
>>> cp.Y := 0;
>>> Edit1.CaretPos := cp;
>>>
>>> I would like to use literal directly, such as:
>>>
>>> Edit1.CaretPos := (X: 0, Y: 0); 
>>>
>>> But the above syntax is wrong. Is there such thing exists?
>>>
>>> Thanks,
>>> Shannon
>>>
>>>
>>> --
>>> _______________________________________________
>>> Lazarus mailing list
>>> Lazarus at lists.lazarus.freepascal.org
>>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
>
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130109/6a5f0061/attachment-0003.html>


More information about the Lazarus mailing list