Jonas Maebe 25 years ago
parent
commit
f0c5ba2976
1 changed files with 31 additions and 0 deletions
  1. 31 0
      tests/tbf/tbff002.pp

+ 31 - 0
tests/tbf/tbff002.pp

@@ -0,0 +1,31 @@
+type
+
+  ExecProc = Procedure;
+  
+type
+  MenuItem = record
+               Caption: String[32];
+               Exec: ExecProc;
+             end;
+             
+Procedure AddItem(ACaption: String; AExec: ExecProc; var Item: MenuItem);
+begin
+  Item.Caption:=ACaption;
+  Item.Exec:=AExec;
+end;
+
+Procedure ExecFirstItem;
+begin
+  Writeln('Result of "Item 1"');
+end;
+
+var M1,M2,M3: MenuItem;
+    Ep: ExecProc;
+
+begin
+  AddItem('Item 1',Nil,M1);
+  Ep:=ExecFirstItem;        // should give error in fpc mode
+  AddItem('Item 2',Ep,M2);
+  AddItem('Item 3',@ExecFirstItem,M3);
+end.
+