My Delphi 11 FMX project has multiple document windows.
How can I detect in code whether or not the window is in the background? (Windows and Macintosh)
The Active: Boolean
property indicates whether the form has focus.
Note, however:
In procedure TCommonCustomForm.Activate;
the Active
property is set True
before OnActivate
is called.
In procedure TCommonCustomForm.Deactivate;
the Active
property is set False
after OnDeactivate
is called.
Therefore, referring to the Active
property in these events (OnActivate
and OnDeactivate
) might be error prone. OTOH, the events already tell what the state will be after exit.
Outside of these events the Active
property correctly indicate the actual state.