On Fri, 13 Jan 2023, Wayne Sherman via fpc-devel wrote:
Is there a better way to track changed TBaseObject properties (and get
rid of property index declarations)?
Not to my knowledge. If there had been, I would have used it.
The advantage of the index as opposed to using a custom assigned ID per
property is that the compiler enforces them and stores them in RTTI.
thus they are a safe mechanism.
Lazarus knows which properties on a form have been changed from their
default value and only properties which do not match the default are
saved in the lfm file. Can the same thing be used with TBaseObject
properties?
No, since you don't have a 'default' value as in the lazarus sense:
In lazarus, the default is a default as declared in the class.
In rest, the default value is what you got from the server.
(or empty in case you create a new object)
Your misunderstanding is that you consider any write of a property a
modification, as in Lazarus.
But in rest, only writes that happen after the load from the server
are modifications.
Hence the stoprecording/startrecording which seems wrong to you, but is in
fact correct and as designed.
Michael.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel