When a user drops a file on my application, I'd like to give them some options as to what to do with it. I use a PopupMenu for this.
Because OSX gives your window focus only when you hover over it for, say, half a second, it can happen people drop a file without the window having focus. This creates all sorts of problems with the PopupMenu that's created on filesDropped().
- The PopupMenu gets destroyed as soon as you mouse-exit it
- I believe the popup gets destroyed as soon as the window does gain focus (using e.g. cmd+tab)
What's the best way to solve this? Can I force my window to take focus after dropping a file? Should I not use PopupMenu? Is this simply a restriction from OSX and can't it be helped?
(getTopLevelComponent()->toFront(true); doesn't work, but I've never done this and the documentation of DocumentWindow is rather...lacking, in this respect).