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

# TCustomButton.ActiveDefaultControlChanged

Updates the button and/or parent form when the active default control has been changed.

## Declaration

Source position: stdctrls.pp line 1250

`public procedure TCustomButton.ActiveDefaultControlChanged(`
`NewControl: TControl`
`); override;`

## Arguments

`NewControl` |  | New value assigned as the active default control in the parent form.

## Description

ActiveDefaultControlChanged is an overridden method used to update properties in the control and/or parent form when active default control has been changed. NewControl contains the control which is the ActiveControl given focus on the parent form, or Nil when a button control loses focus.

When NewControl is the current class instance, its Active property is set to True to reflect the active focused control status. The ActiveDefaultControl property in the parent form is set to the current control to indicate it is also the active default control for the form.

When NewControl is assigned, but a different control than the current instance, the button control is not focused and its Active property is set to False.

When NewControl is unassigned (Nil), the button control has just lost focus and Active is set to the value in the Default property. The control is also removed as the ActiveDefaultControl in the parent form (when needed).

ActiveDefaultControlChanged is called from the UpdateFocus method.

## See also

TControl.ActiveDefaultControlChanged |  | Notification of a changed active DefaultControl of a form.