Yes. I am facing the same problem. I am updating the menu in performSelectorOnMainThread. If the menu is kept open without any event then there is menu refreshing issue ie. sometimes some items will be shown twice. When I move the mouse over items then it will update. But, when the menu is open and mouse is still then the menu won't update. Is there a way to update the menu while it's open without any mouse movement like System WiFi menu?
Best regards, VinPai On Fri, Apr 20, 2012 at 11:42 AM, Ken Thomases <k...@codeweavers.com> wrote: > On Apr 18, 2012, at 3:14 PM, vinayak pai wrote: > >> I have a NSMenu with dynamically added NSMenuItems. The NSMenu is not >> refreshing properly while it's kept open. >> The NSMenu update method is called in NSRunLoopCommonModes. > > I think I've answer you in another forum, but you can simply call the > appropriate methods of NSMenu and NSMenuItem to modify them. > > For example, my company's application, CrossOver, populates a "Programs" menu > by scanning the contents of a particular folder. The menu starts out with a > single disabled "Loading…" item. In a background thread, the app scans the > folder and builds a hierarchy of programs. When the scan is complete, it > does a -performSelectorOnMainThread:… to install that hierarchy in the menu. > > Since the scanning is occurring on a background thread, it is "spontaneous" > from the point of view of the UI. If the Programs menu is pulled down when > it completes, the menu will update itself. However, in doing some testing > right now, I see that it only updates when some event occurs. Mouse movement > is enough. However, if I pull down the menu and leave the mouse still, it > will not update no matter how long I leave it. Then, when I move the mouse, > poof, the menu updates. Testing done on Lion 10.7.3. > > Regards, > Ken > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com