NSStatusBar drag & drop with menu

973 views Asked by At

I'm familiar with the technique described here: Drag and Drop with NSStatusItem to make an NSStatusBar item that can handle file drag & drop.

What is the proper method for having a status bar item that supports both drag & drop and regular menu interactions, much like the Cloudapp icon does.

I want users to be able to left click the NSStatusItem to see the normal menu listing as well as allow for file drag and drop functionality.

It seems to me like I have to write all my own click handler code if I use a custom view on an NSStatusItem. So I'd have to detect clicks and display my menu items myself manually.

I just want to make sure there is no easier (or better) way before I start implementation.

1

There are 1 answers

0
Thorsten Karrer On

As far as I know you need the custom view on your NSStatusItem to handle the drag and drop. In this case it is easy, though, to add click handling to the view as well. You do not have to draw the menu yourself---if that is what you're asking---it should suffice to call - (void)popUpStatusItemMenu:(NSMenu *)menu on your NSStatusItem.