Invalid class Typecast

Delphi

16/02/2005

estou criando um componte até ai beleza ele tem uma propriedade DataBase do tipo TDatabase e também tem a propriedade TableName onde listo todas as tabelas ligadas ao Database até ai funcionando normal. Bom criei um TCollection onde tem uma propriedade FieldName onde seria para listar os fields da tabelas só que qdo eu clico na propriedade para poder listas os fileds da o seguinte erro ´Invalid class Typecast´ algém ja passou por isso? sabe oque podee ser?

abaixo segue uma parte do código
  TShowFieldsItem = Class(TCollectionItem)
  private
    FCaption: String;
    FFieldName: String;
    procedure SetCaption(const Value: String);
    procedure SetFieldName(const Value: String);
  protected
    function GetDisplayName : string; override;
  public
    constructor Create(Collection : TCollection); override;
    destructor Destroy; override;
  published
    property Caption : String read FCaption write SetCaption;
    property FieldName : String read FFieldName write SetFieldName;
  end;

  TShowFields = Class(TCollection)
  private
    FOwner : TComponent;
    function GetItems(Index: integer): TShowFieldsItem;
    procedure SetItems(Index: integer; const Value: TShowFieldsItem);
  protected
    function GetOwner : TPersistent; override;
  public
    constructor Create(AOwner : TComponent);
    function Add : TShowFieldsItem;
    function Insert(Index : integer) : TShowFieldsItem;
    property Items[Index : integer] : TShowFieldsItem read GetItems write SetItems;
  end;
  TCustomProperty = class (TStringProperty)
  public
    function GetAttributes: TPropertyAttributes; override;
  end;

  TSearchTableProperty = class (TCustomProperty)
  public
    procedure GetValues(Proc: TGetStrProc); override;
  end;

  TSearchFieldProperty = class (TCustomProperty)
  public
    procedure GetValues(Proc: TGetStrProc); override;
  end;

procedure Register;
begin
  RegisterComponents(´Renato´, [TSearch]);
  RegisterPropertyEditor (TypeInfo(String), TSearch, ´TableName´, TSearchTableProperty);
  RegisterPropertyEditor (TypeInfo(String), TShowFieldsItem, ´FieldName´, TSearchFieldProperty);
end;



Rhosaka

Rhosaka

Curtidas 0
POSTAR