lcl: recreate menu item if it is owned by another menu before showing (issue #0014144)

git-svn-id: trunk@24179 -
This commit is contained in:
paul 2010-03-23 08:12:12 +00:00
parent c24efa3adf
commit d0352dc2c2

View File

@ -274,15 +274,30 @@ begin
end;
procedure TMenuItem.CheckChildrenHandles;
function GetMenu(Item: TMenuItem): TMenu;
begin
repeat
Result := Item.Menu;
Item := Item.Parent;
until (Result <> nil) or (Item = nil);
end;
var
i: Integer;
AMenu: TMenu;
begin
if FItems <> nil then
begin
AMenu := GetMenu(Self);
for i := 0 to Count - 1 do
begin
if Items[i].Visible then
begin
if Items[i].HandleAllocated and (GetMenu(Items[i]) <> AMenu) then
Items[i].DestroyHandle;
Items[i].HandleNeeded;
end;
end;
end;
end;