[ City Zoo | Announcements | Aritcles | Tips & Tricks | Bug List | FAQ | Sites ]
Non-visual components that are derived from TComponent and are created dynamically (e.g. not created by dropping them on the form) will not be painted on the form until it is reloaded. For example, consider that you design Component A to rely on Component B for some type of information or control. When an instance of Component A is dropped on a form, it must create Component B itself if there is not one already on the form. When Component B is created this way, it will not appear on the form until it is reloaded. Descendants of TComponent do not suffer from this problem.
Don't derive your component from TComponent if it may be dynamically created by other components.
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.