Einzelnen Beitrag anzeigen

Benutzerbild von phlux
phlux

Registriert seit: 4. Nov 2002
Ort: Witten
1.335 Beiträge
 
Delphi 6 Personal
 
#4

Re: Property vom Typ TStrings einer neuen Komponente hinzufü

  Alt 14. Mai 2003, 11:10
Zitat von Hansa:
Wie hast Dus denn bisher versucht
also bisher hab ichs so versucht (ich kürze den code jetz mal aufs geringste)

Delphi-Quellcode:
unit ControlTabs;

interface

uses
  Windows, Messages, SysUtils, Classes, Controls, Graphics;

type
  TControlTabs = class(TCustomControl)
  private
    FItems: TStrings;
    procedure SetItems(const Value: TStrings);
    { Private declarations }
  protected
    { Protected declarations }
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    { Public declarations }
  published
    { Published declarations }
    property Items: TStrings read FItems write SetItems;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('CR-Soft', [TControlTabs]);
end;

{ TControlTabs }

constructor TControlTabs.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FItems := TStringList.Create;
end;

procedure TControlTabs.SetItems(const Value: TStrings);
begin
  FItems := Value;
// SetLength(FButtons, FItems.Count); //FButtons: Array of TRect
end;

destructor TControlTabs.Destroy;
begin
  FItems.Free;
  inherited;
end;

end.
Christian "phlux" Arndt
  Mit Zitat antworten Zitat