[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Forms' (#lcl)

# SaveFocusState

Saves the last focus state (focused control) in an application.

## Declaration

Source position: forms.pp line 1955

`function SaveFocusState: TFocusState;`

## Function result

Last control which had focus in the application.

## Description

SaveFocusState returns the value from the LastFocusedControl variable in the implementation for the unit. The type used for the return value is TFocusState, and is a Pointer to the TWinControl instance in LastFocusedControl.

SaveFocusState is used, along with RestoreFocusState, in form and dialog methods (like SetFocusedControl, ShowModal, and Execute) and when the value in FocusedForm is updated in TScreen.

## See also

RestoreFocusState |  | Restores the previous focus state for an application to the specified value.
TCustomForm.ShowModal |  | Displays the form as a modal dialog.
TCustomForm.SetFocusedControl |  | Handles a focus change for a control (enter/exit messages).
TScreen.FocusedForm |  | The form that has Focus on the screen.
TFocusState |  | Pointer to focus state information for the last active control in an application.
TCommonDialog.Execute |  | Displays the dialog and captures the result.