(CodeLib-Manager)
Registriert seit: 5. Aug 2004
Ort: München
1.062 Beiträge
|
Re: Tastatur --> Shift --> alle eventualitäten
2. Feb 2006, 21:56

Zitat von xaromz:
Wer schafft weniger if-Abfragen  ?
Wenne schon so danach fragst...
Delphi-Quellcode:
function ShiftStateToString(s: TShiftState): string;
const
Shifts: array[0..2] of TShiftState = ([ssAlt], [ssShift], [ssCtrl]);
strings: array[0..2] of string = ('Alt', 'Shift', 'Control');
formatStrings: array[boolean] of string = ('', '%s + ');
var
i: byte;
begin
result := '';
for i := 0 to 2 do
result := result + format(formatStrings[(Shifts[i] * s) <> []], [strings[i]]);
delete(result, length(result) - 2, 2);
end;
greetz
Mike
Mike Passion is no replacement for reason
|
|
Zitat
|