TActionlist, OnUpdate, High CPU Usage? [duplicate]

五迷三道 提交于 2019-12-13 06:43:53

问题


I use the TActionslists OnUpdate event to enable or disable the buttons in my application.
But I noticed my cpu using 25% of its capability.
When I remove the code triggerd on the event my cpu usage still remains 25%.
Only if I unhook the event completely does my cpu run at expected 1%.

It seems the OnUpdate event fires way to many times.
Is there a way to prevent this behavior?


回答1:


The VCL provides Application.ActionUpdateDelay to help in such situations. Set it to a non-zero value to force a delay between successive action updating.

However, it might be more prudent to find out why your action is forcing endless repeated OnIdle conditions. If you can stop it doing so then there's no need for update delay.



来源:https://stackoverflow.com/questions/14828279/tactionlist-onupdate-high-cpu-usage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!