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 be aware that I moderate all comments, so there will be a delay before your comment appears.
Advertising spam and the rare abusive, hateful or racist comments will be blocked and reported.
Finally, should you have a query about, or a bug report for, one of my programs or libraries please use the relevant issue tracker rather than posting a comment to report it.
Thanks