(Text version)
Borland Delphi
[ City Zoo | Announcements | Articles | Tips & Tricks | Bug List | FAQ | Sites ]



The Delphi Bug List

Component Design


Real typed properties cause GPF in COMPLIB.DCL.

Description:

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.
Solution:

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.

® Delphi is a registered trademark of Borland International.
[ Home Page | What's New | About CITY ZOO | Borland Delphi | About the Authors | INDEX ]


keeper@mindspring.com
Copyright © 1995 Mark R. Johnson. This is a CITY ZOO production.
Produced in conjunction with Brad Stowers.
Last revised December 29, 1995.