Forum > LCL

TTrayIcon.PopupMenu.OnPopup on MacOS

<< < (2/2)

howardpc:
I only just took note that this is for MacOS, whose menu system differs significantly from Win/Linux with which I am familiar.
So sorry, no experience there to help you.

dbannon:
OnMeasureItem is marked as Restricted on Mac in the Object Inspector. But I see no mention of OnPopup also being so.

But the SystemTray is very OS dependent, it does no more that the OS permits and often quite a lot less. So, it could be a case of MacOS just does not fire an event before displaying the menu. Probably worth looking in the code.

I guess you have tested that a popmemu does fire OnPopUp if its attached to just a button of a form rather than the SystemTray ?

Davo

trev:
The OP may find my macOS-specific Wiki article on NSStatusBar useful. 

dbannon:
Hmm, thats interesting trev, should we consider modifying the existing Lazarus System Tray Unit to work through the StatusBar instead ?

My application is quite happy with a pure SystemTray approach but I am not suprised all functions are not available. They are not in any modern Linux for example ....

D

CCRDude:

--- Quote from: dbannon on November 10, 2022, 12:29:25 pm ---I guess you have tested that a popmemu does fire OnPopUp if its attached to just a button of a form rather than the SystemTray
--- End quote ---

I use it quite often to update Enabled states of actions available in the menu based on context, but I tried again.

In this context, I found another "interesting" part:

If I call .Popup for the same TPopupMenu that's associated with the TTrayIcon, the .OnPopup event is triggered, but afterwards, the tray icon won't open the menu any more!

(I guess I need to test on trunk to be sure this hasn't been fixed, but I can't install a trunk version through fpcupdeluxe as I usually do, because of insufficient disk space for XCode. Will have to find another way or finally replace the SDD :) )


--- Quote from: trev on November 11, 2022, 12:31:16 am ---The OP may find my macOS-specific Wiki article on NSStatusBar useful.

--- End quote ---

Indeed, thanks a lot! Would need some more attention to Apples framework, since I use checked menu items, submenus etc, but sounds interesting.

Navigation

[0] Message Index

[*] Previous page

Go to full version