I have a big application with hundreds of TActions. Each of them is used and implements different functionality needed.
It is possible to catch (hook) all the TAction.OnExecute from an application? Is there any windows message which I can hook so I can log the action name which was executed?
You just need to add a TApplicationEvents
object and handle the OnActionExecute
event. The event handler is passed the Action
instance and so can readily obtain the name of the action.
The OnActionExecute
event will fire before the action's OnExecute
event fires. You can even stop the action's OnExecute
event from firing by setting the Handled
parameter to True
in your OnActionExecute
event handler.