Einzelnen Beitrag anzeigen

mjustin

Registriert seit: 14. Apr 2008
3.005 Beiträge
 
Delphi 2009 Professional
 
#9

Re: If Anweisungen verkleinern

  Alt 10. Mai 2009, 11:10
Schritt 0: Deklaration der Aufzählungstypen und eines Sets:

Delphi-Quellcode:
type
  TSize = (ciKlein, ciMittel, ciGroß);
  TSizes = set of TSize;
var
  Sizes: TSizes;
Schritt 1: Mapping von String auf den Aufzählungstyp, in Set aufnehmen

Delphi-Quellcode:
if Customer_Info[1,28,1] = 'Kleinthen
  Include(Sizes, ciKlein)
else if Customer_Info[1,28,1] = 'Mittelthen
  Include(Sizes, ciMittel)
else if Customer_Info[1,28,1] = 'Großthen
  Include(Sizes, ciGroß);
Schritt 2: ein, zwei oder drei Items der Stringlist hinzufügen

Delphi-Quellcode:
if not (ciKlein in Sizes) then
  ComboBoxFirmenG.Items.Add('Klein');

if not (ciMittel in Sizes) then
  ComboBoxFirmenG.Items.Add('Mittel');

if not (ciGroß in Sizes) then
  ComboBoxFirmenG.Items.Add('Groß');
Michael Justin
habarisoft.com
  Mit Zitat antworten Zitat