Registriert seit: 26. Aug 2004
Ort: Nebel auf Amrum
3.154 Beiträge
Delphi 7 Enterprise
|
Re: Befehl kürzen
10. Feb 2008, 22:22
Hier doch nochmal ein Vorschlag...
Delphi-Quellcode:
type
TMyResult = (_None, _True, _False);
function Test(FahrzeugkennungA, FahrzeugkennungB,
CaptionA, CaptionB, CaptionC:string;
falscherstatus:boolean):TMyResult;
begin
Result:=_None;
if (CaptionA = FahrzeugkennungA)
and ( (CaptionB <> '4')
or (CaptionB <> '6')
or (CaptionB <> '7')
or (CaptionB <> '8')
or (CaptionB <> '3')
or not falscherstatus) then
begin
Result:=_True;
end
else if (CaptionC = FahrzeugkennungB)
and ((CaptionA = '1') or (CaptionA = '2') or (CaptionA = '5')) then
begin
Result:=_False;
end;
end;
procedure TForm.Proc(var status:boolean);
var F4K, CapA, CapC:string;
begin
F4K:=Fahrzeug4.fkennung;
CapA:=gb19.Caption;
CapC:=gb20.Caption;
case Test(Fahrzeug1.fkennung, F4K, CapA, btbg19.Caption, CapC, status) of
_True: btbg19.Caption:='3';
_False: status:=true;
end;
case Test(Fahrzeug2.fkennung, F4K, CapA, btbg19.Caption, CapC, status) of
_True: btbg19.Caption:='3';
_False: status:=true;
end;
case Test(Fahrzeug3.fkennung, F4K, CapA, btbg19.Caption, CapC, status) of
_True: btbg19.Caption:='3';
_False: status:=true;
end;
case Test(Fahrzeug4.fkennung, F4K, CapA, btbg19.Caption, CapC, status) of
_True: btbg19.Caption:='3';
_False: status:=true;
end;
CapA:=gb20.Caption;
CapC:=gb20.Caption;
case Test(Fahrzeug1.fkennung, F4K, CapA, btbg20.Caption, CapC, status) of
_True: btbg20.Caption:='3';
_False: status:=true;
end;
case Test(Fahrzeug2.fkennung, F4K, CapA, btbg20.Caption, CapC, status) of
_True: btbg20.Caption:='3';
_False: status:=true;
end;
case Test(Fahrzeug3.fkennung, F4K, CapA, btbg20.Caption, CapC, status) of
_True: btbg20.Caption:='3';
_False: status:=true;
end;
case Test(Fahrzeug4.fkennung, F4K, CapA, btbg20.Caption, CapC, status) of
_True: btbg20.Caption:='3';
_False: status:=true;
end;
end;
Nicht schön, aber selten...
|