Hallo,
ich habe eine variable, die ich mit einer Procedure belegen kann. möchte aber vorm ausführen testen, ob sie belegt ist... leider mekert der compiler
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22:
| TFunction = procedure of Object; VarFunction: TFunction;
procedure MachWas; begin showmessage('Hallo'); end;
procedure VarFunctionRuecksetzen; begin VarFunction:= nil; end;
procedure VarFunctionSetzen; begin VarFunction:= MachWas; end;
procedure VarFunctionAusfuehren; begin if VarFunction <> nil then VarFunction; end; |
hat jemand eine idee, wie ich das machen kann?
ein workaround wäre das hier:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
| procedure VarFunctionRuecksetzen; begin VarFunction:= doNothing; end;
procedure doNothing; begin end;
procedure VarFunctionAusfuehren; begin doNothing; end; |
vielen dank.
tim.