Advertisement
HEX0x29A

Callback

Feb 7th, 2017
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.47 KB | None | 0 0
  1. type
  2.   TCallback = function(Value: string): Boolean;
  3.  
  4. function Call(Value: string): Boolean;
  5. begin
  6.   ShowMessage(Value);
  7.   Result := Boolean(Random(2));
  8. end;
  9.  
  10. procedure Proc(Callback: TCallback);
  11. begin
  12.   if Assigned(Callback) then
  13.     ShowMessage('Callback вернул ' +BoolToStr(Callback('Внутри callback'), True));
  14.   ShowMessage('Внутри процедуры');
  15. end;
  16.  
  17. procedure TForm1.FormCreate(Sender: TObject);
  18. begin
  19.   Proc(Call);
  20.   Halt;
  21. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement