- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
用户可以通过多种方式触发操作(TAction)执行:快捷键、工具栏按钮、弹出菜单按钮等。是否可以获取该操作如何被触发的信息?
我只是在考虑事件日志的实现,以找出在 GUI 中使用不同功能的最流行的方法。
更新
我需要收集一些有关用户如何与应用程序 GUI 交互的统计信息。
仅仅因为需要实现日志记录就为每个按钮创建单独的操作并不是最好的主意。乌尔里希·格哈特的答案看起来很合适。我可以为 TActionList.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.
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可能还有更多“钩子(Hook)”。
关于delphi - TAction 是通过什么方式被触发的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5501123/
在Delphi XE5中:我的窗体上有一个TActionManager(称为ActionManager)和一个TRibbon(称为Ribbon)。我正在添加这样的自定义操作: ActionBar :=
我发现(在 Delphi 2010 中)快捷方式总是以具有该操作的第一个窗体(由主窗体拥有)结束,而不是当前聚焦的窗体。我的 TMainFrm 拥有多个 TViewFrm。每个都有一个 TAction
用户可以通过多种方式触发操作(TAction)执行:快捷键、工具栏按钮、弹出菜单按钮等。是否可以获取该操作如何被触发的信息? 我只是在考虑事件日志的实现,以找出在 GUI 中使用不同功能的最流行的方法
我在 Form2 上有一个 Action 列表 (actlst11),它被放置在运行时 TTabSheet 上来自主窗体的页面控件(如 here )。 我添加了一个快捷方式 Num +对于 actZo
我想稍微简化将表单状态保存到磁盘的过程。我使用我自己的从 TIniFile 派生的 INI 文件类来读取表单中“所有”控件的状态。像这样的东西: procedure TMyIniFile.Read(C
我正在使用 Delphi TActionList,带有用于某些操作的快捷键。 我想防止某些操作被键盘自动重复多次触发,但我不想全局影响自动重复操作。最好的方法是什么? 澄清:我仍然需要处理多个快速按键
我有 2 个表单,我想共享一个 TActionManager 并分配了 TAction-s。 第一个表单是主表单 - 它包含 TActionManager、TAction 以及标题“Action”。
我有一些菜单项,其操作如下: procedure TMISMainFrm.ActiSalesInvoiceExecute(Sender: TObject); begin if CheckMdiLi
在Delphi XE7中,我使用这个技巧根据ListView中的项目是否被选择来自动启用或禁用工具栏按钮(“编辑ListView项目”),以防止用户单击该按钮(如果有)没有选择 ListView 项目
我为带有 TAction 列表的 TActionClientItem 创建了一个下拉菜单。我想知道如何 Hook 菜单或其中每个 TAction 的绘图事件以以不同的方式显示这些 TAction 的标
在我的自定义组件中,我创建了一些 TAction-s 作为子组件。它们都已发布,但我无法在设计时分配它们,因为它们无法通过对象检查器获得。 如何让对象检查器“可迭代”它们?我尝试将操作的所有者设置为自
我刚刚使用了Delphi TAction 的SecondaryShortCuts-Feature。但快捷键是由字符串定义的,例如“F5”或“Shift+F5”。现在的问题是:在我的德语 Windows
我有一个 TAction,可用于菜单项和 TButton。我希望菜单项显示标签,并且 TButton 仅显示图标。但是,当分配一个 Action 时,Vcl 会自动设置 TButton 的 Capti
我有一个带有面板的表单。 我在运行时创建框架,并通过将框架的父属性设置为面板来将它们显示在面板上。 创建面板时,我不设置所有者属性,因为我自己管理框架的生命周期。 到目前为止我没有遇到任何问题。接下来
首先,我已经知道,当你实现一个TSpeedButton时,当你分配它的Glyph时,如果你没有多个字形,那么NumGlyphs 应为 1,禁用时为 it will automatically use
我正在开发一个Word插件,不知何故,TAction.ShortCut中定义的快捷方式总是被触发多次,这对我来说很棘手,很难解决,所以我求助于TForm.OnKeyDown事件并清除了所有TActio
我已经尝试过这个: actZoomReset.ShortCut := TextToShortCut('Ctrl+Num 0'); 但这没有任何作用(ShortCut = 0)。 编辑: 如果我尝试在
我已经尝试过这个: actZoomReset.ShortCut := TextToShortCut('Ctrl+Num 0'); 但这没有任何作用(ShortCut = 0)。 编辑: 如果我尝试在
如果 TAction 链接到对象,例如 TToolButton(TToolBar 的项目)或 TActionClientItem( TActionToolBar 的项目)并且该对象在运行时可见,那么每
我是一名优秀的程序员,十分优秀!