Class helper for updating a TActionList
On occasions I've wanted to provoke all actions in an action list to update themselves - when waiting for the application to update them when idle isn't soon enough.
I would have thought that TActionList would have a suitable method, but it doesn't seem to.
To save having to come up with the same hack over and again, I've started using this class helper:
type
TActionListHelper = class helper for TCustomActionList
public
procedure Update;
end;
...
procedure TActionListHelper.Update;
var
Action: TContainedAction;
begin
for Action in Self do
Action.Update;
end;
You can now update all the actions in an action list by calling the Update that has been injected into any TActionList instance.
Seems to work so I thought I'd share it.
If you've got a better way, please comment.
Comments
Post a Comment
Comments are very welcome, but please don't comment here if:
1) You have a query about, or a bug report for, one of my programs or libraries. Most of my posts contain a link to the relevant repository where there will be an issue tracker you can use.
2) You have a query about any 3rd party programs I feature, please address them to the developer(s) - there will be a link in the post.
3) You're one of the tiny, tiny minority who are aggressive or abusive - in the bin you go and reported you will be!
Thanks