diff --git a/lcl/include/application.inc b/lcl/include/application.inc index 7d0bc131ed..9a0fab20d6 100644 --- a/lcl/include/application.inc +++ b/lcl/include/application.inc @@ -869,10 +869,15 @@ procedure TApplication.IconChanged(Sender: TObject); var i: integer; begin + Icon.OnChange := nil; + + Icon.Current := Icon.GetBestApplicationIndex; Widgetset.AppSetIcon(GetIconHandle); if FFormList<>nil then for i :=0 to FFormList.Count - 1 do TForm(FFormList[i]).Perform(CM_ICONCHANGED, 0, 0); + + Icon.OnChange := @IconChanged; end; {------------------------------------------------------------------------------ diff --git a/lcl/include/customform.inc b/lcl/include/customform.inc index 1b9238bca7..a4455ca120 100644 --- a/lcl/include/customform.inc +++ b/lcl/include/customform.inc @@ -161,8 +161,13 @@ End; ------------------------------------------------------------------------------} procedure TCustomForm.IconChanged(Sender: TObject); begin + Icon.OnChange := nil; + + Icon.Current := Icon.GetBestApplicationIndex; if HandleAllocated then TWSCustomFormClass(WidgetSetClass).SetIcon(Self, GetIconHandle); + + Icon.OnChange := @IconChanged; end; {------------------------------------------------------------------------------