[lazarus] New Bug Entered

bugtracker at miraclec.com bugtracker at miraclec.com
Wed Jul 16 15:25:22 EDT 2003



Title: Foward class reference disables RTTI in property editor

Entered by: Tom Lisjac

Declaring a forward class reference for a component masks access to it in the property editor after it is installed. The component runs fine if manually initialized at runtime but the property editor is completely blank when viewing it in the IDE at design time. An example is attached that reproduces the problem.

A workaround that restores design time access is to remove the forward reference, declare generic pointers and typecast them where needed.

unit fwdtest;

interface

uses
  SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type

  TMain = class;

  TMainXprops = class(TPersistent)
  private
    fParent:TMain;
    finteger:integer;
    fString: String;
  published
    property Parent :TMain read fParent write fParent;
    property AnInteger:Integer read finteger write finteger;
    property AString:String read fString write fString;
  end;


  TMain = class(TComponent)
  private
    fy:TMainXProps;
  Public
    Constructor Create(AOwner:TComponent); Override;
    Destructor Destroy; Override;
  published
    property testprop:TMainXProps read fy write fy;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents(\'Misc\', [TMain]);
end;

{ TMain }

constructor TMain.Create(AOwner: TComponent);
begin
  inherited;
  fy:=TMainXProps.Create;
end;

destructor TMain.Destroy;
begin
  fy.free;
  inherited;
end;

end.






More information about the Lazarus mailing list