AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein GUI-Design mit VCL / FireMonkey / Common Controls Delphi Property vom Typ TStrings einer neuen Komponente hinzufügen

Property vom Typ TStrings einer neuen Komponente hinzufügen

Ein Thema von phlux · begonnen am 13. Mai 2003 · letzter Beitrag vom 14. Mai 2003
Antwort Antwort
Benutzerbild von phlux
phlux

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

Property vom Typ TStrings einer neuen Komponente hinzufügen

  Alt 13. Mai 2003, 22:02
Hi!
Also im moment versuche ich einer neuen Komponente eine Property namens Items hinzuzufügen, diese soll vom Typ TStrings bzw. TStringlist sein. Sobald ich jetzt jedoch im Objektinspektor die Property Items modifiziere (sprich: Ich schreibe ein, zwei Strings hinein) und dann das Projekt starte kriege ich Accessviolations und Delphi schmiert ab . Woran liegt das?? bzw. wie kann ich die Property richtig implementieren??
Christian "phlux" Arndt
  Mit Zitat antworten Zitat
Hansa

Registriert seit: 9. Jun 2002
Ort: Saarland
7.554 Beiträge
 
Delphi 8 Professional
 
#2

Re: Property vom Typ TStrings einer neuen Komponente hinzufü

  Alt 13. Mai 2003, 23:14
Zitat von phlux:
...wie kann ich die Property richtig implementieren??
Wie hast Dus denn bisher versucht
Gruß
Hansa
  Mit Zitat antworten Zitat
Dezipaitor

Registriert seit: 14. Apr 2003
Ort: Stuttgart
1.701 Beiträge
 
Delphi 7 Professional
 
#3
  Alt 14. Mai 2003, 09:42
ja das ist typisch delphi,
damit hatte ich auch meine probleme,
und deshal habe ich das tutorial objekteigenschaften.rtf erstellt,
dass man runterladen kann.

http://home.t-online.de/home/5200017...eTutorials.zip

hoffe es hift dir.
Christian
Windows, Tokens, Access Control List, Dateisicherheit, Desktop, Vista Elevation?
Goto: JEDI API LIB & Windows Security Code Library (JWSCL)
  Mit Zitat antworten Zitat
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
Benutzerbild von Motzi
Motzi

Registriert seit: 6. Aug 2002
Ort: Wien
598 Beiträge
 
Delphi XE2 Professional
 
#5
  Alt 14. Mai 2003, 11:54
SetItems sollte so ausschaun:
Delphi-Quellcode:
procedure TControlTabs.SetItems(const Value: TStrings);
begin
  FItems.Assign(Value);
end;
Manuel Pöter
  Mit Zitat antworten Zitat
Benutzerbild von phlux
phlux

Registriert seit: 4. Nov 2002
Ort: Witten
1.335 Beiträge
 
Delphi 6 Personal
 
#6
  Alt 14. Mai 2003, 12:05
danke motzi, klappt wunderbar
das passiert wenn man sich ganz faul die prozeduren von delphi schreiben lässt
Christian "phlux" Arndt
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:45 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz