From 1dfb84cfbcf14ad3d8087cef029a84736da7a46e Mon Sep 17 00:00:00 2001 From: wp_xyz Date: Thu, 16 Dec 2021 14:06:26 +0100 Subject: [PATCH] LCL/TColorBox, TColorListbox: Add missing Notification procedure. Issue #39518. (cherry picked from commit 6efaae3d24b2ed130a294db717cc2298794559d8) --- lcl/colorbox.pas | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lcl/colorbox.pas b/lcl/colorbox.pas index 1c5bb7cc56..ff82269fe1 100644 --- a/lcl/colorbox.pas +++ b/lcl/colorbox.pas @@ -49,7 +49,7 @@ type FColorRectOffset: Integer; FDefaultColorColor: TColor; FNoneColorColor: TColor; - FcolorDialog:TColorDialog; + FColorDialog:TColorDialog; FOnGetColors: TGetColorsEvent; FStyle: TColorBoxStyle; FSelected: TColor; @@ -76,6 +76,7 @@ type procedure DoGetColors; virtual; procedure CloseUp; override; function PickCustomColor: Boolean; virtual; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; public constructor Create(AOwner: TComponent); override; property ColorRectWidth: Integer read GetColorRectWidth write SetColorRectWidth stored ColorRectWidthStored; @@ -198,6 +199,7 @@ type procedure DoGetColors; virtual; procedure DoSelectionChange(User: Boolean); override; function PickCustomColor: Boolean; virtual; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; public constructor Create(AOwner: TComponent); override; property ColorRectWidth: Integer read GetColorRectWidth write SetColorRectWidth stored ColorRectWidthStored; @@ -738,6 +740,14 @@ begin end; end; +procedure TCustomColorBox.Notification(AComponent: TComponent; Operation: TOperation); +begin + inherited Notification(AComponent, Operation); + if (Operation = opRemove) and (AComponent = FColorDialog) then + FColorDialog := nil; +end; + + {------------------------------------------------------------------------------} {------------------------------------------------------------------------------ Method: TCustomColorListBox.Create @@ -1095,5 +1105,12 @@ begin end; end; +procedure TCustomColorListBox.Notification(AComponent: TComponent; Operation: TOperation); +begin + inherited Notification(AComponent, Operation); + if (Operation = opRemove) and (AComponent = FColorDialog) then + FColorDialog := nil; +end; + {------------------------------------------------------------------------------} end.