destroying TMenu Handle when Set Parent=nil

git-svn-id: trunk@6333 -
This commit is contained in:
mattias 2004-12-05 13:20:29 +00:00
parent a398928537
commit 5c02893c8b
2 changed files with 13 additions and 3 deletions

View File

@ -1013,7 +1013,10 @@ begin
if (Screen.Forms[I].Menu = Value) and (Screen.Forms[I] <> Self) then
raise EInvalidOperation.CreateFmt(sDuplicateMenus, [Value.Name]);
if FMenu<>nil then FMenu.Parent:=nil;
if FMenu<>nil then begin
FMenu.Parent:=nil;
end;
if (csDestroying in ComponentState) or
((Value <> nil) and (csDestroying in Value.ComponentState))
@ -1820,6 +1823,9 @@ end;
{ =============================================================================
$Log$
Revision 1.166 2004/12/05 13:20:29 mattias
destroying TMenu Handle when Set Parent=nil
Revision 1.165 2004/11/20 11:20:06 mattias
implemented creating classes at run time from any TComponent descendant

View File

@ -49,12 +49,13 @@ end;
{------------------------------------------------------------------------------
procedure TMenu.SetParent(const AValue: TComponent);
Creates the handle ( = object).
------------------------------------------------------------------------------}
procedure TMenu.SetParent(const AValue: TComponent);
begin
// ToDo
if FParent=AValue then exit;
FParent:=AValue;
if (Items<>nil) and Items.HandleAllocated then
DestroyHandle;
end;
procedure TMenu.ImageListChange(Sender: TObject);
@ -241,6 +242,9 @@ end;
{ =============================================================================
$Log$
Revision 1.27 2004/12/05 13:20:29 mattias
destroying TMenu Handle when Set Parent=nil
Revision 1.26 2004/11/10 20:53:18 vincents
Destroy menu handle, when destroying form handle.