mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 12:09:30 +02:00
+ added
This commit is contained in:
parent
fa38093530
commit
f0c5ba2976
31
tests/tbf/tbff002.pp
Normal file
31
tests/tbf/tbff002.pp
Normal file
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user