Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Einzelne Werte aus set of-Variable lesen (https://www.delphipraxis.net/92636-einzelne-werte-aus-set-variable-lesen.html)

Andreas L. 23. Mai 2007 18:09


Einzelne Werte aus set of-Variable lesen
 
Hi,
ich habe mir eine einen Set-of-type (oder wie man das nennen mag) deklariert:

Delphi-Quellcode:
type
  TOptions = set of (opAllowUrls, opAllowRelativePaths, opAllowLocalFiles);
Dies verwende ich dann als Property meiner Komponente:

Delphi-Quellcode:
 private
    { Private-Deklarationen }
    FFileOptions: TOptions;
  protected
    { Protected-Deklarationen }
  public
    { Public-Deklarationen }
  published
    { Published-Deklarationen }
    property FileOptions: TOptions read FFileOptions write FFileOptions;
Wenn ich jetzt abfragen möchte ob bspw. die Option opAllowUrls Boolean ist kann ich ja nicht einfach if FFileOptions = [opAllowUrls] then .... verwenden, wenn mehrere Optionen ausgewählt werden. Wie könnte ich das anstellen ohne für jede Möglichkeit eine if-Abfrage zu basteln?

fLaSh11 23. Mai 2007 18:18

Re: Einzelne Werte aus set of-Variable lesen
 
Delphi-Quellcode:
if opAllowUrls in FFileOptions then

Andreas L. 23. Mai 2007 18:40

Re: Einzelne Werte aus set of-Variable lesen
 
Das war ja einfach :shock:

Danke :mrgreen:


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:24 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz