diff --git a/lcl/controls.pp b/lcl/controls.pp index ac21ca34a6..272ae2d79a 100644 --- a/lcl/controls.pp +++ b/lcl/controls.pp @@ -872,7 +872,8 @@ type chtOnVisibleChanged, chtOnEnabledChanging, chtOnEnabledChanged, - chtOnKeyDown + chtOnKeyDown, + chtOnBeforeDestruction ); TLayoutAdjustmentPolicy = ( @@ -1118,6 +1119,7 @@ type procedure SetAccessibleValue(AValue: TCaption); procedure SetAccessibleRole(AValue: TLazAccessibilityRole); procedure SetAnchorSide(Kind: TAnchorKind; AValue: TAnchorSide); + procedure SetAnchorSide(AIndex: Integer; AValue: TAnchorSide); procedure SetBorderSpacing(const AValue: TControlBorderSpacing); procedure SetBoundsRect(const ARect: TRect); procedure SetBoundsRectForNewParent(const AValue: TRect); @@ -1455,6 +1457,7 @@ type public constructor Create(TheOwner: TComponent);override; destructor Destroy; override; + procedure BeforeDestruction; override; procedure EditingDone; virtual; procedure ExecuteDefaultAction; virtual; procedure ExecuteCancelAction; virtual; @@ -1521,6 +1524,9 @@ type procedure AddHandlerOnKeyDown(const OnKeyDownEvent: TKeyEvent; AsFirst: boolean = false); procedure RemoveHandlerOnKeyDown(const OnKeyDownEvent: TKeyEvent); + procedure AddHandlerOnBeforeDestruction(const OnBeforeDestructionEvent: TNotifyEvent; + AsFirst: boolean = false); + procedure RemoveHandlerOnBeforeDestruction(const OnBeforeDestructionEvent: TNotifyEvent); public // standard properties, which should be supported by all descendants property AccessibleDescription: TCaption read GetAccessibleDescription write SetAccessibleDescription; diff --git a/lcl/include/control.inc b/lcl/include/control.inc index 928f4801b0..ca3a674744 100644 --- a/lcl/include/control.inc +++ b/lcl/include/control.inc @@ -2139,6 +2139,11 @@ begin GetAnchorSide(Kind).Assign(AValue); end; +procedure TControl.SetAnchorSide(AIndex: Integer; AValue: TAnchorSide); +begin + +end; + procedure TControl.SetBorderSpacing(const AValue: TControlBorderSpacing); begin if FBorderSpacing=AValue then exit; @@ -4554,6 +4559,18 @@ begin RemoveHandler(chtOnKeyDown,TMethod(OnKeyDownEvent)); end; +procedure TControl.AddHandlerOnBeforeDestruction( + const OnBeforeDestructionEvent: TNotifyEvent; AsFirst: boolean); +begin + AddHandler(chtOnBeforeDestruction,TMethod(OnBeforeDestructionEvent)); +end; + +procedure TControl.RemoveHandlerOnBeforeDestruction( + const OnBeforeDestructionEvent: TNotifyEvent); +begin + RemoveHandler(chtOnBeforeDestruction,TMethod(OnBeforeDestructionEvent)); +end; + procedure TControl.RemoveAllHandlersOfObject(AnObject: TObject); var HandlerType: TControlHandlerType; @@ -4711,6 +4728,12 @@ begin {$ENDIF} end; +procedure TControl.BeforeDestruction; +begin + inherited BeforeDestruction; + DoCallNotifyHandler(chtOnBeforeDestruction); +end; + {------------------------------------------------------------------------------ Method: TControl.Create Params: None