[ City Zoo | Announcements | Articles | Tips & Tricks | Bug List | FAQ | Sites ]
Adding a published property that is based on a variable of type Real causes Delphi to GPF. To illustrate the problem, install this example component and add it to a form:
unit RealBug; interface uses WinTypes, WinProcs, Classes, Controls, Forms; type TRealBug = class(TWinControl) private FVersion: Real; published Version: Real read FVersion write FVersion; end; procedure Register; implementation procedure Register; begin RegisterComponents('Bugs', [TRealBug]); end; end.
From the Language Reference manual:
Furthermore, the type of a property defined in a published section must be an ordinal type, a real type (Single, Double, Extended, or Comp, but not Real), a string type, a small set type, a class type, or a method pointer type.
The solution is to use Single, Double, Extended, or Comp, whichever is most appropriate to your data. It would have been better for the compiler to generate an error when attempting to publish a real type property.