Einzelnen Beitrag anzeigen

static_cast

Registriert seit: 19. Okt 2003
Ort: Peine
300 Beiträge
 
#1

Problem mit TColletion zur Designzeit

  Alt 28. Feb 2005, 16:53
Hi,

ich habe ein Problem und zwar versuche ich mit einer TCollection ein TCollectionItems eine Liste zu erstellen die man zur Designzeit im OI bearbeiten kann. Er öffnet einfach nicht das Fenster zum bearbeiten Aber funktionieren tut es soweit ich habe es ausporbiert ich kann zur laufzeits Items erstellen und auf sie zugreifen, nur zur Designzeit geht es nicht.

Der Code ist folgender:

Delphi-Quellcode:
  { TAccount }

  TAccount = class(TCollectionItem)
  private
    FValue: String;
    procedure SetValue(const Value: String);
  protected
  public
    constructor Create(ACollection: TCollection); override;
  published
    property Value:String read FValue write SetValue;
  end;

  { TAccounts }

  TAccounts = class(TCollection)
  private
    FOwner: TPersistent;
    function GetItem(Index: Integer): TAccount;
    procedure SetItem(Index: Integer; Value: TAccount);
  protected
    function GetOwner: TPersistent; override;
  public
    constructor Create(Owner: TPersistent);
    function Add: TAccount;
    property Items[Index: Integer]: TAccount read GetItem write SetItem; default;
  end;

  { TAccountProperties }

  TAccountProperties = class(TPersistent)
  private
    FVisibleAccounts: TAccountTypes;
    FAccounts: TAccounts;
    procedure SetVisibleAccounts(const Value: TAccountTypes);
    procedure SetAccounts(Value: TAccounts);
  protected
  public
    constructor Create;
    destructor Destroy; override;
  published
    property Accounts:TAccounts read FAccounts write SetAccounts;
    property VisibleAccounts:TAccountTypes read FVisibleAccounts write SetVisibleAccounts;
  end;
Delphi-Quellcode:
{ TAccountProperties }

constructor TAccountProperties.Create;
begin
  FAccounts:=TAccounts.Create(Self);
  VisibleAccounts:=atAll;
end;

destructor TAccountProperties.Destroy;
begin
  FreeAndNil(FAccounts);
  inherited;
end;

procedure TAccountProperties.SetAccounts(Value: TAccounts);
begin
  FAccounts.Assign(Value);
end;

procedure TAccountProperties.SetVisibleAccounts(const Value: TAccountTypes);
begin
  FVisibleAccounts:=Value;
end;

{ TAccount }

constructor TAccount.Create(ACollection: TCollection);
begin
  inherited Create(ACollection);
end;

procedure TAccount.SetValue(const Value: String);
begin
  FValue := Value;
end;

{ TAccounts }

function TAccounts.Add: TAccount;
begin
  Result := TAccount(inherited Add);
end;

constructor TAccounts.Create(Owner: TPersistent);
begin
  inherited Create(TAccount);
  FOwner:=Owner;
end;

function TAccounts.GetItem(Index: Integer): TAccount;
begin
  Result := TAccount(inherited GetItem(Index));
end;

function TAccounts.GetOwner: TPersistent;
begin
  Result := FOwner;
end;

procedure TAccounts.SetItem(Index: Integer; Value: TAccount);
begin
  inherited SetItem(Index, Value);
end;
Grüße,
Daniel.

P.S.: bin @work und hier benutzen wir Delphi 5 Pro (wenn das von relevants ist )
Daniel M.
"The WM_NULL message performs no operation. An application sends the WM_NULL message if it wants to post a message that the recipient window will ignore."
  Mit Zitat antworten Zitat