ApplicationIdle

ApplicationIdle

不忙的时候调用此事件

::Fmx::Forms::Application->OnIdle = ApplicationIdle;

void __fastcall TForm1::ApplicationIdle(TObject *Sender, bool &Done)
{
    ButtonStart->Enabled = !DSServer()->Started;
    ButtonStop->Enabled = DSServer()->Started;
    EditPort->Enabled = !DSServer()->Started;
}

Occurs when an application becomes idle.

Write an OnIdle event handler to perform special processing when an application is idle. An application is idle when it is not processing code. For example, an application is idle when it is waiting for input from the user.

OnIdle is called only once, as the application transitions into an idle state. It is not called continuously unless the Done parameter is set to false. Applications that set Done to false consume an inordinate amount of CPU time, which affects overall system performance. 

原文地址:https://www.cnblogs.com/cb168/p/4690297.html