Re: [fpc-devel] Published record

2024-08-18 Thread baldzhang via fpc-devel
you may try this: TSomeObjToSerial = class(TPersistent) private FPoint: TPoint; public property Point: TPoint read FPoint write FPoint; published property PointX: Integer read FPoint.x write FPoint.x; property PointY: Integer read FPoint.y write FPoint.y; end; not tested by compiler, bu

Re: [fpc-devel] Published record

2024-08-18 Thread Michalis Kamburelis via fpc-devel
Thank you -- this is excellent information, both RTTI for records and lazarus/components/jitclasses/ . So I really have all the puzzle pieces I need :) I have recorded a TODO to handle it all in https://castle-engine.io/roadmap#records_rtti . Regards, Michalis niedz., 18 sie 2024 o 10:49 Michael

Re: [fpc-devel] Published record

2024-08-18 Thread Michael Van Canneyt via fpc-devel
On Sat, 17 Aug 2024, Michalis Kamburelis wrote: Thanks Michael! OK, that's partially good news :) I understand that streaming records by default to LFM would lead to too many questions (and I'm unsure whether Delphi does it too, for records and DFM). It does not. Streaming has not change

Re: [fpc-devel] Published record

2024-08-17 Thread Michalis Kamburelis via fpc-devel
Thanks Michael! OK, that's partially good news :) I understand that streaming records by default to LFM would lead to too many questions (and I'm unsure whether Delphi does it too, for records and DFM). If this means they are not allowed in the "published" section, *but* the RTTI is capable of te

Re: [fpc-devel] Published record

2024-08-17 Thread Michael Van Canneyt via fpc-devel
On Sat, 17 Aug 2024, Kostas Michalopoulos via fpc-devel wrote: On 8/16/24 8:40 PM, Michalis Kamburelis via fpc-devel wrote: If we could instead just put TVector3 in the published section, and make it exposed in the object inspector (maybe adding some additional code to use RTTI, but that is

Re: [fpc-devel] Published record

2024-08-17 Thread Michael Van Canneyt via fpc-devel
On Fri, 16 Aug 2024, Michalis Kamburelis via fpc-devel wrote: You cannot publish records, and this is not planned. This is because things like MyClass.MyRecord.MyField:=12; do not work as one would naively expect. It does work if you use a TPersistent instead of a record (the very reason t

Re: [fpc-devel] Published record

2024-08-17 Thread Kostas Michalopoulos via fpc-devel
On 8/16/24 8:40 PM, Michalis Kamburelis via fpc-devel wrote: If we could instead just put TVector3 in the published section, and make it exposed in the object inspector (maybe adding some additional code to use RTTI, but that is made *once*, not every time we need to expose TVector3) this would b

Re: [fpc-devel] Published record

2024-08-16 Thread Michalis Kamburelis via fpc-devel
> You cannot publish records, and this is not planned. > > This is because things like > > MyClass.MyRecord.MyField:=12; > > do not work as one would naively expect. It does work if you use a TPersistent > instead of a record (the very reason the TPersistent class was invented) Do you mean the tra

Re: [fpc-devel] Published record

2024-08-15 Thread Michael Van Canneyt via fpc-devel
On Thu, 15 Aug 2024, Mattias Gaertner via fpc-devel wrote: Hi, What is the state of published record in fpc trunk? You cannot publish records, and this is not planned. This is because things like MyClass.MyRecord.MyField:=12; do not work as one would naively expect. It does work if you

[fpc-devel] Published record

2024-08-15 Thread Mattias Gaertner via fpc-devel
Hi, What is the state of published record in fpc trunk? The structures in typinfo.pp seems to be pretty complete, but fpc complains: unit1.pas(42,24) Error: This kind of property cannot be published {$mode delphi} interface uses Classes, TypInfo; type TMyRec = record x,y: integer; e