Removes the focus from the control that has the focus, leaving no control with the focus. On Windows only, the application also no longer receives KeyDown events.
Calling ClearFocus is similar to calling the Window class method, SetFocus. On Macintosh and Linux, they are the same. On Windows, the application no longer receives Keydown events. After a call to Window.SetFocus, the application will continue to receive KeyDown events, which it can accept by returning True from this event.
You can set the focus using the SetFocus property of the RectControl class. Please note that the SetFocus method of the RectControl class does nothing when the control it is being applied to is not capable of having the focus on the platform on which the code is running.
The following code in the Action event of a PushButton removes the focus from the object in the window that has the focus, leaving no control with the focus until the user selects or clicks in a control that can get the focus.