开发者

Why doesn't TApplicationEvents.OnIdle get called?

in my app I have a main form with a button. Clicking this button, a form (not auto-created in dpr) is created and displayed; on this form, I placed a TApplicationEvents component and I defined its OnIdle event handler. This event handler doesn't get called! May this depend because I derived this second 开发者_Python百科form not from TForm but from an other class, TChartBasicForm (by means of VFI)? Thank you very much for replies. Massimo.


Hooking an application's idle event can lead to a lot of debugging woes and other maintenance headaches, especially on a form other than the main form. I realize this may not answer your specific question (which is hard to do at this point given the vagueness), but are you sure you can't accomplish what you're trying to do with a TTimer or TThread instead?


Thanks for interest to all people. "It doesn't work" means that it's not called at all. Instead, the event OnShowHint works!

Ooops! Perhaps I have understood the bad behaviour! In the main form I defined a procedure like this one:

procedure IdleHandler(Sender: TObject; var Done: Boolean);

and in the FormCreate:

Application.OnIdle := IdleHandler;

This probably inhibits TApplicationEvents.OnIdle, even if in IdleHandler, at the end of the procedure, I put:

Application.OnIdle := nil;

because the code is usefull to try a connection only at the begin of the application.

I beg your pardon: my face is red......

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜