Autor Beitrag
schitho
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 288

XP Home SP2
D2005 Prof
BeitragVerfasst: So 14.11.04 22:41 
Hi,

hab wieder einmal eine typische Anfängerfrage:

Wie kann ich prüfen, ob eine Variable (Aufzählungstyp) leer ist.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
Type
  TFarbe = (rot, grün blau)

var
  Farbe : TFarbe


Wie kann ich nun feststellen, dass Farbe noch leer ist (also weder rot, grün noch blau enthält)??

Danke

Gruß
Thomas

_________________
(Sorry! Leider ewiger Delphi-Neuling)
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 14.11.04 22:53 
Farbe kann nur rot (0), gruen (1) oder blau (2) enthalten.

Oder meinst du Sets?

Bei Sets geht's mit

ausblenden Delphi-Quelltext
1:
If DWORD(SetVariable) = 0 Then SetIstLeer;					

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
schitho Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 288

XP Home SP2
D2005 Prof
BeitragVerfasst: So 14.11.04 23:13 
Danke für die Antwort.

Hatte einen Denkfehler :oops:

Wenn noch kein Wert zugewisen wurde, dann ist Farbe rot (eh klar).

Danke

Gruß
Thomas

_________________
(Sorry! Leider ewiger Delphi-Neuling)