NSPopover Appear from Menubar

Discussion in 'Mac Programming' started by AppleDev879, Oct 2, 2011.

  1. AppleDev879 macrumors newbie

    Joined:
    Mar 1, 2011
    #1
    I'm developing a simple menu bar app in which an icon in the menu bar should show an NSPopover. How can I get the popover to display based on the icon's position in the menubar?

    The popular calendar app, Fantastical, is a good example of this behavior.

    Thanks.
     
  2. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    The trick seems be to set a custom view in the status item and use the custom view when sending showRelativeToRect:ofView:preferredEdge: to the NSPopover. But you'll need to custom draw the view and handle mouseDown in the view.
     
  3. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #3
    Note that NSPopover has some pretty serious issues with control focus when used from the menubar. Fantastical's popover is a custom version, I believe.
     

Share This Page