OnActionExecute (Delphi)
Description
This example requires a TApplicationEvents, a TActionList, and a TListBox on the form. Select the TApplicationEvents, double-click the OnActionExecute event and add the following code to the handler. Create an TAction named MyAction in a TActionList. The TActionList must have no OnExecute event handler, while the TAction has an OnExecute event handler, called MyActionExecute. Then set an object's Action (such as a button) to MyAction. The Handled parameter of the event handler returns False by default. If the handler handles the event, it should change Handled to True, thus preventing further attempts to handle the action.
Code
procedure TMainForm.ApplicationEventsActionExecute(Action: TBasicAction;
var Handled: Boolean);
begin
lbOther.Items.Add('Event OnActionExecute');
end;
procedure TMainForm.MyActionExecute(Sender: TObject);
begin
ShowMessage('Action executed');
end;