I have an NSMenu which opens when a user clicks an NSStatusItem in the status bar. How can I determine if the NSMenu is opened (expanded) or not?
Thank you!
You can use the NSMenuDelegate
protocol to handle menuWillOpen
and menuWillClose
messages. Use menuWillOpen
to set a boolean that states that the menu is open, and menuWillClose
to turn it off.
Update: Looks like menuWillClose:
is no longer an available delegate method. Use menuDidClose:
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With