如何让快捷键根据活动选项卡页执行不同的操作?
我的 TPageControl
上的每个 TTabSheet
上都有一个 TToolBar
。每个工具栏都有一个 TToolButton
,它应该响应相同的键盘快捷键。如何提供热键以便为当前页面调用右侧按钮?
在第一个选项卡上, Ctrl+T 应该会发生一些事情,但是切换到第二个选项卡时, Ctrl+T< /kbd> 应该让其他事情发生。
当选项卡显示或隐藏时,是否需要在 asNormal
和 asSuspished
之间切换 TActionList.State
?
Each TTabSheet
on my TPageControl
has a TToolBar
on it. Each tool bar has a TToolButton
that should respond to the same keyboard shortcut. How do I provide hotkeys so that the right button is invoked for the current page?
On the first tab sheet, Ctrl+T should make something happen, but upon switching to the second tab, Ctrl+T should make something else happen instead.
Is this a time to toggle TActionList.State
between asNormal
and asSuspended
when tab sheets are shown or hidden?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您希望 Ctrl+T 只是在
PageControl
上的活动TabSheets
之间切换,则创建一个 操作,使用 Ctrl+T 快捷键,并根据需要在页面之间翻转:If you want Ctrl+T simply to flip between active
TabSheets
on aPageControl
, then create a single Action, with a Ctrl+T shortcut, and flip between pages as required:如果您希望一个 TAction 根据启动它的控件执行不同的操作,只需查看该操作的
ActionComponent
属性即可。将所有控件挂钩到同一操作。另一种方法是使用相同的快捷方式进行多个操作,并根据可见或聚焦的内容在更新事件中启用或禁用它们。
If you want one TAction to do different things depending on what control initiated it, just look at the action's
ActionComponent
property. Hook all the controls to the same action.An alternative would be to have multiple actions with the same shortcut and enable or disable them in the Update event based on what is visible or focused.