TAction已被解雇了哪种方式? [英] Which way that TAction has been fired?

查看:105
本文介绍了TAction已被解雇了哪种方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户可以通过多种方式触发动作(TAction):快捷键,工具栏按钮,弹出式菜单按钮等。是否可以获取该动作已被触发的信息?

There are a lot of ways how user can trigger an action (TAction) execution: shortcut keys, toolbar button, popup menu button etc. Is it possible to get information how that action has been triggered?

我正在考虑实施活动日志,以了解在GUI中使用不同功能的最流行方式。

I'm just thinking about implementation of activity log to figure out the most popular ways to use different features in GUI.

更新

我需要收集有关用户如何与应用程序GUI交互的统计信息。

I need to collect some stats about how an user interact with application GUI.

由于您需要实现日志记录,所以不要为每个按钮创建一个单独的动作。乌尔里希·格哈特的回答看起来很合适。我可以将一个处理程序分配给TActionList.OnExecute事件,并从一个地方写入日志。

It's not the best idea to create a separate action for every button just because you need to implement logging. Ulrich Gerhardt's answer looks suitable. I can assign a handler to TActionList.OnExecute event and write log from one place.

推荐答案

也许你可以使用 ActionComponent


使用ActionComponent来辨别哪个
客户端组件将此操作导致
执行。例如,如果您需要知道
用户操作是否触发此操作,则从OnExecute
事件处理程序中检查
ActionComponent。

Use ActionComponent to discern which client component caused this action to execute. For example, examine ActionComponent from an OnExecute event handler if you need to know what user action triggered this action.

当用户单击客户端控件时,
客户端在调用操作的执行
方法之前设置ActionComponent
。执行操作后,
操作将ActionComponent重置为nil
(Delphi)或NULL(C ++)。

When the user clicks a client control, that client sets ActionComponent before calling the action's Execute method. After the action executes, the action resets ActionComponent to nil (Delphi) or NULL (C++).

还有 TApplication.OnActionExecute TActionList.OnExecute 和可能更多的钩子。

There is also TApplication.OnActionExecute, TActionList.OnExecute and probably more "hooks".

这篇关于TAction已被解雇了哪种方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆