Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Komponente mit Lines erstellen (https://www.delphipraxis.net/9066-komponente-mit-lines-erstellen.html)

Nalincah 17. Sep 2003 15:00


Komponente mit Lines erstellen
 
wie muss ich den "type" deklarieren wenn ich sowas wie Lines haben will (Wie beim Memo). Damits verständlicher wird:

Delphi-Quellcode:
type
  TTreffpunkt = (tpBahnhof, tpBushalteStelle, tpZOB, tpTaxiStand);
Ergibt DropDownList mit den Einträgen

Delphi-Quellcode:
type
  TTreffpunkt = set of (tpBahnhof, tpBushalteStelle, tpZOB, tpTaxiStand);
Ergibt Untermenü mit den Einträgen (True/False) wie bei Font.

Wie geht das mit Lines????

sakura 17. Sep 2003 15:01

Re: Komponente mit Lines erstellen
 
Lines ist vom Typ TStrings oder TStringList. Damit geht es recht einfach ;-)

...:cat:...

Nalincah 17. Sep 2003 15:15

Re: Komponente mit Lines erstellen
 
Und wie binde ich das ein??? :freak:

Nalincah 17. Sep 2003 15:25

Re: Komponente mit Lines erstellen
 
Delphi-Quellcode:
type
  FQuellFelderListe = set of TStringList;
Wenn ich das so mach sagt der:

Code:
Ordinaltyp erforderlich

sakura 17. Sep 2003 15:37

Re: Komponente mit Lines erstellen
 
Viel einfacher...
Delphi-Quellcode:
type
  TMeineKompo = class(TComponent)
  private
    FLines: TStringList;
    procedure SetLines(Value: TStringList);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  published
    property Lines: TStringList read FLines write SetLines;
  end;

....

constructor TMeineKompo.Create(AOwner: TComponent);
begin
  inherited;
  FLines := TStringList.Create;
end;

destructor TMeineKompo.Destroy;
begin
  FLines.Free;
  inherited;
end;

procedure TMeineKompo.SetLines(Value: TStringList);
begin
  FLines.Assign(Value);
end;
Fertig :-)

...:cat:...


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:44 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