lcl: on changing Form.Icon or Application.Icon set its current to best index for application

git-svn-id: trunk@15616 -
This commit is contained in:
paul 2008-06-30 03:15:43 +00:00
parent 3152e64236
commit 4619b1b098
2 changed files with 10 additions and 0 deletions

View File

@ -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;
{------------------------------------------------------------------------------

View File

@ -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;
{------------------------------------------------------------------------------