mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 22:50:22 +02:00
cocoa: use number of items, of inserting a menu item for the first time
git-svn-id: trunk@62701 -
This commit is contained in:
parent
d9daa6776b
commit
dfd2b9ea65
@ -512,6 +512,7 @@ var
|
|||||||
item : NSMenuItem;
|
item : NSMenuItem;
|
||||||
MenuObj : NSObject;
|
MenuObj : NSObject;
|
||||||
Menu : NSMenu;
|
Menu : NSMenu;
|
||||||
|
idx : Integer;
|
||||||
begin
|
begin
|
||||||
if not Assigned(AMenuItem) or (AMenuItem.Handle=0) or not Assigned(AMenuItem.Parent) or (AMenuItem.Parent.Handle=0) then Exit;
|
if not Assigned(AMenuItem) or (AMenuItem.Handle=0) or not Assigned(AMenuItem.Parent) or (AMenuItem.Parent.Handle=0) then Exit;
|
||||||
ParObj:=NSObject(AMenuItem.Parent.Handle);
|
ParObj:=NSObject(AMenuItem.Parent.Handle);
|
||||||
@ -549,7 +550,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
if Assigned(item) then
|
if Assigned(item) then
|
||||||
Parent.insertItem_atIndex(NSMenuItem(item), AMenuItem.MenuVisibleIndex)
|
begin
|
||||||
|
idx := AMenuItem.MenuVisibleIndex;
|
||||||
|
if idx < 0 then idx := Parent.numberOfItems;
|
||||||
|
Parent.insertItem_atIndex(NSMenuItem(item), idx)
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user