LCL-GTK3: Support TFrame as a MenuItem's owner. Issue #40446, patch by haword.

This commit is contained in:
Juha 2023-08-24 11:00:19 +03:00
parent 805a8817ed
commit dfbe6ad23d

View File

@ -256,7 +256,6 @@ var
MenuItem: TGtk3MenuItem;
ParentMenuWidget, ContainerMenu: PGtkWidget;
NewMenu: TGtk3Menu;
AOwner: TControl;
AForm: TCustomForm;
begin
if not AMenuItem.HandleAllocated then
@ -290,13 +289,9 @@ begin
ParentMenuWidget := TGtk3Widget(AMenuItem.Parent.Handle).Widget;
end;
if ((not AMenuItem.Parent.HasParent) and (AMenuItem.GetParentMenu is TMainMenu)) then
if (not AMenuItem.Parent.HasParent) and (AMenuItem.GetParentMenu is TMainMenu) then
begin
AOwner := TControl(AMenuItem.GetParentMenu.Owner);
if AOwner is TFrame then
AForm := GetParentForm(AOwner)
else
AForm := TCustomForm(AOwner);
AForm := TCustomForm(AMenuItem.GetParentMenu.Parent);
PGtkMenuBar(TGtk3Window(AForm.Handle).GetMenuBar)^.append(PGtkMenuItem(MenuItem.Widget));
end else
(*