如何在运行时访问 Delphi 2009 功能区按钮的选中属性?
我想在单击任何功能区按钮时将功能区的所有 TAction 对象的“checked”属性重置为 false,然后仅在按下的按钮上将其设置为 true。 但我还没有找到一种方法来访问 ActionManager 的 Actions 的所有“checked”属性。 我想我需要循环遍历动作管理器的动作列表......但是,但我还没有找到正确的方法。 如果有人能给我一些提示,我会很高兴。
谢谢!
I want to reset the "checked" property of all TAction objects of a ribbon to false when clicking on any ribbon button and then only set it true on the pressed button.
But I did not yet find a way to access all the "checked" properties of the ActionManager's Actions.
I think I need to loop through the actionmanager's actionlist... however, but I did not yet find the right way to do.
I'd be very glad if someone could give me some hint on this.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
TActionManager
源自TCustomActionList
,因此无论您能用后者做什么,您都可以用前者做什么。 它有两个您需要使用的属性:Actions
,它是一个数组属性,可让您访问所有列表的操作;ActionCount
,它告诉您有多少个操作有。 使用它们编写一个普通的循环,如下所示:操作列表可以容纳多种类型的操作,并且它们并不都具有
Checked
属性。 该属性是在TCustomAction
中引入的,因此上面的代码也过滤掉了不属于该类的内容。TActionManager
descends fromTCustomActionList
, so whatever you can do with the latter, you can do with the former. It has two properties you'll need to use,Actions
, which is the array property that gives you access to all the list's actions, andActionCount
, which tells you how many there are. Use them to write an ordinary loop, like this:Action lists can hold lots of kinds of actions, and they don't all have
Checked
properties. That property is introduced inTCustomAction
, so the code above also filters out the things that don't descend from that class.