• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Programmatically dismiss NSPopUpButton menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatically dismiss NSPopUpButton menu


  • Subject: Re: Programmatically dismiss NSPopUpButton menu
  • From: Jeff Johnson <email@hidden>
  • Date: Fri, 12 Sep 2008 15:54:25 -0500

On Sep 12, 2008, at 3:16 PM, Peter Ammon wrote:

On Sep 12, 2008, at 11:40 AM, Jeff Johnson wrote:

I have a NSView that only appears in a window when a certain activity is in progress, and there's an NSPopUpButton in the view that acts as a gear menu with actions that relate to the activity in progress. The issue is that if the button's menu is still open when activity finishes and the view is removed from the window, the button is gone but the menu is still displayed, and I can't get the menu to dismiss before I remove the view.

The method -[NSPopUpButtonCell dismissPopUp] doesn't seem to work. I've filed <rdar://problem/6216372> on that.

I've tried a bunch of different things to dismiss the popup menu, but none of them have worked. I'd greatly appreciate hearing about any proven techniques for dismissing the popup menu. Thanks!

-Jeff


You're looking for -[NSMenu cancelTracking].

Ah yes, thanks! That's 10.5-only? I didn't see it because the app still supports Tiger, so I was looking in the 10.4 docs. Is there a 10.4 method for this?


Note that this is somewhat against Mac OS X UI conventions, as menus normally don't go away unless the user dismisses them.

Yes, the UI itself is a little unconventional, because the popup button itself, along with the containing view, disappears, so I didn't want to leave a orphaned menu.


Imagine the user is about to click on a menu item, and the menu vanishes and the user triggers whatever was behind it. Consider instead handling the case where the user chooses a menu item after the operation has finished with a gentle error message.


Good point about accidentally triggering what's behind the menu. I don't know if I want to bother the user with an error message, since it's a matter of timing. I could disable all the menu items, though, right?

-Jeff

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Programmatically dismiss NSPopUpButton menu
      • From: Peter Ammon <email@hidden>
References: 
 >Programmatically dismiss NSPopUpButton menu (From: Jeff Johnson <email@hidden>)
 >Re: Programmatically dismiss NSPopUpButton menu (From: Peter Ammon <email@hidden>)

  • Prev by Date: Re: Newb: Targeting an instance of a class instantiated by a NIB file
  • Next by Date: Re: Newb: Targeting an instance of a class instantiated by a NIB file
  • Previous by thread: Re: Programmatically dismiss NSPopUpButton menu
  • Next by thread: Re: Programmatically dismiss NSPopUpButton menu
  • Index(es):
    • Date
    • Thread