mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 06:08:22 +02:00
35 lines
594 B
ObjectPascal
35 lines
594 B
ObjectPascal
{ %FAIL }
|
|
{ Old file: tbf0361.pp }
|
|
{ }
|
|
|
|
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.
|