• 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
populate/resize an already open NSMenu in background
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

populate/resize an already open NSMenu in background


  • Subject: populate/resize an already open NSMenu in background
  • From: Martin Wierschin <email@hidden>
  • Date: Fri, 19 Dec 2008 13:21:48 -0800

Hi everyone,

I have a menu that needs to be populated on demand, so I've set an NSMenu delegate and note the update request in "menuNeedsUpdate:". The problem is that populating the menu can take quite a while, so results need to be generated in the background and then added as they come in. Think of something like the system Spotlight menu, where file matches are appended as they are found.

The problem is that the NSMenu will not resize itself to show items added from outside of "menuNeedsUpdate:". If I call "update" and/or "resizeToFit" the menu does change its display to show the changed/ reordered items, but never resizes itself beyond the capacity established in "menuNeedsUpdate".

Has anyone ever gotten this kind of thing to work? I do notice that moving the mouse to hide the menu and then reshow it allows the NSMenu to resize itself as needed. Perhaps I should look into faking mouse events to trigger this kind of thing programmatically- seems like a horrible hack.

Thanks for any advice,
~Martin

_______________________________________________

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: populate/resize an already open NSMenu in background
      • From: Peter Ammon <email@hidden>
  • Prev by Date: Re: NSLog ??
  • Next by Date: Determining width of a cell in an NSOutlineView
  • Previous by thread: [Fwd: Re: [Q] How to let the pasteboard know a file type?]
  • Next by thread: Re: populate/resize an already open NSMenu in background
  • Index(es):
    • Date
    • Thread