Window.Focus

From Xojo Documentation

Property (As RectControl )
aWindow.Focus = newRectControlValue
or
RectControlValue = aWindow.Focus

Supported for all project types and targets.

Gets or sets the RectControl in the window that has the focus. If no control has the focus, this property is Nil.

Example

The following example reports on the control in the ContainerControl that has the focus.

MsgBox(ContainerControl11.Focus.Name)