GetFocus Function

Class

DesktopWin and MoveableWin.

Action

Returns the control with the input focus.

Availability

This functionality is supported only if you are using the Classic Agent.

Syntax

wInput = window.GetFocus( )
Variable Description
wInput The control with the focus. WINDOW.

Notes

GetFocus returns the control that has the input focus (that is, the control to which keystrokes are directed) in the specified window (for a MoveableWin), or for any open window (when used with the DesktopWin class). If no control has the focus, Silk Test Classic raises the exception E_NO_FOCUS_WINDOW.

Only controls can have input focus, not top-level windows, such as an application’s main window or dialog boxes.

Example

WINDOW wFocusWindow
 wFocusWindow = Find.GetFocus()