[SOLVED] Adding items to TPopupMenu not updating in Mac menu bar (TTrayIcon) lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- Hansaplast · 2015-09-10 10:46 I'm not sure if this is expected behavior or not, so I'm asking if anyone could confirm if this is the case or if this is a bug ... When I add menu items at runtime to a TPopupMenu as follows: Code: [Select]... var tmpMenuItem:TMenuItem; ... begin    tmpMenuItem := TMenuItem.Create(PopupMenu1);    tmpMenuItem.Caption:='test menuitem';    PopupMenu1.Items.Add(tmpMenuItem); ... Then for a regular TPopupMenu this works just fine (as expected). However ... when the TPopupMenu is attached to a TTrayIcon (so it appears in the Mac Menu Bar) something interesting happens. The menu in the menu bar of the Mac does NOT update. So when I click the TrayIcon, the new item does not appear in the menu. However when I call: Code: [Select]PopupMenu1.Popup; The popup menu appears (on the form, so not in the menu bar) with the item added. I've tested and reproduced this under MacOS X 10.10 and 10.11 (beta), using Lazarus 1.4.2 and FPC 2.6.4. ---------------------------------------------------------------------- Hansaplast · 2015-09-10 11:01 This must be an update issue ... When I disconnect the popupmenu from the TrayIcon, it still shows ... (TrayIcon1.PopUp:=nil;) When I destroy PopupMenu1 after disconnecting, it STILL shows and even works (gives an error after it did what it was supposed to do when the menu still "existed"). (PopupMenu1.Destroy;) When not destroying PopupMenu1, but instead destroying TrayIcon1, the menu disappears. Recreating TrayIcon1 at runtime, and re-assigning the popup menu, does not work - the menu never shows. What DOES work is hiding the TrayIcon, modify the menu, and show the TrayIcon again, so: First set TrayIcon1.visible:=FALSE; Add/Remove your menu item(s). Set TrayIcon1.visible:=TRUE; Now the added menu items do show correctly. Is this expected behavior? ---------------------------------------------------------------------- Hansaplast · 2015-09-21 10:59 Totally had not found this post before addressing a similar problem. Appears that TrayIcon1.InternalUpdate; will do the trick as well.