Application.Deactivate
From Xojo Documentation
Event
The app is being deactivated.
Notes
For example, this occurs when the user clicks on a window belonging to another app. When the user clicks on your app window again, the Activate event is called.