Re: Updating NSMenu while it's open

2012-04-24 Thread vinayak pai
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

Re: Updating NSMenu while it's open

2012-04-24 Thread Ken Thomases
On Apr 20, 2012, at 1:32 PM, vinayak pai wrote: 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

Re: Updating NSMenu while it's open

2012-04-24 Thread vinayak pai
posting an application-defined event (NSEvent of type NSApplicationDefined) to the event queue doesn't solve the menu refreshing issue. On Sat, Apr 21, 2012 at 3:44 PM, Ken Thomases k...@codeweavers.com wrote: On Apr 20, 2012, at 1:32 PM, vinayak pai wrote: Yes. I am facing the same problem. I

Re: Updating NSMenu while it's open

2012-04-24 Thread Dave DeLong
Yes. As I answered before, you have to get things scheduled in the right runloop mode. But once you do, it's quite easy: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSStatusItem *item = [[[NSStatusBar systemStatusBar] statusItemWithLength:24] retain];

Re: Updating NSMenu while it's open

2012-04-24 Thread Fritz Anderson
On 20 Apr 2012, at 1:32 PM, vinayak pai wrote: Is there a way to update the menu while it's open without any mouse movement like System WiFi menu? Others may have some magic for you (the list has only just come unstuck, and hasn't gotten beyond Friday as I write this), but you should be

Re: Updating NSMenu while it's open

2012-04-24 Thread Dave DeLong
On Apr 21, 2012, at 3:14 AM, Ken Thomases wrote: On Apr 20, 2012, at 1:32 PM, vinayak pai wrote: 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

Re: Updating NSMenu while it's open

2012-04-24 Thread Kyle Sluder
On Apr 24, 2012, at 2:50 PM, Fritz Anderson fri...@manoverboard.org wrote: On 20 Apr 2012, at 1:32 PM, vinayak pai wrote: Is there a way to update the menu while it's open without any mouse movement like System WiFi menu? Others may have some magic for you (the list has only just come

Re: Updating NSMenu while it's open

2012-04-20 Thread Ken Thomases
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

Re: Updating NSMenu while it's open

2012-04-20 Thread Graham Cox
On 20/04/2012, at 3:45 PM, vinayak pai wrote: System's wifi menu updates while it's open. How to update the menu like this? Add a view to the NSMenuItem. Animate the view using a timer, etc. --Graham ___ Cocoa-dev mailing list

Re: Updating NSMenu while it's open

2012-04-19 Thread Uli Kusterer
On 19.04.2012, at 04:46, Dave DeLong wrote: That's slightly different. That's run by NSMenuItem's alternate mechanism. It sounds like what the OP was asking for was dynamically adding and removing NSMenuItems while the menu is open. Just a short caveat: If this menu can change a lot, it

Re: Updating NSMenu while it's open

2012-04-19 Thread Andy Lee
On Apr 18, 2012, at 10:46 PM, Dave DeLong wrote: On Apr 18, 2012, at 7:43 PM, Andy Lee wrote: [...] Another example is the File menu in some apps such as Safari, TextEdit, and BBEdit. Some menu items change when you hold down the Option key. --Andy That's slightly different. That's

Re: Updating NSMenu while it's open

2012-04-19 Thread vinayak pai
System's wifi menu updates while it's open. How to update the menu like this? On Thu, Apr 19, 2012 at 9:02 PM, Andy Lee ag...@mac.com wrote: On Apr 18, 2012, at 10:46 PM, Dave DeLong wrote: On Apr 18, 2012, at 7:43 PM, Andy Lee wrote: [...] Another example is the File menu in some apps such as

Updating NSMenu while it's open

2012-04-18 Thread vinayak pai
Hi All, 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 appreciate any help with this. Best regards, VinPai ___ Cocoa-dev

Re: Updating NSMenu while it's open

2012-04-18 Thread Jerry Krinock
On 2012 Apr 18, at 13:14, vinayak pai wrote: I have a NSMenu with dynamically added NSMenuItems. The NSMenu is not refreshing properly while it's kept open. I do not believe there is any way to refresh a menu while it is open. The method in which you do your dynamism, -menuNeedsUpdate, is

Re: Updating NSMenu while it's open

2012-04-18 Thread Graham Cox
On 19/04/2012, at 10:04 AM, Jerry Krinock wrote: On 2012 Apr 18, at 13:14, vinayak pai wrote: I have a NSMenu with dynamically added NSMenuItems. The NSMenu is not refreshing properly while it's kept open. I do not believe there is any way to refresh a menu while it is open. The

Re: Updating NSMenu while it's open

2012-04-18 Thread Dave DeLong
Nothing nearly so complicated. You just have to realize that the runloop is in a different mode while the menu is open. If you have a timer to periodically update your menu, then you have to add the timer to the runloop under the NSEventTrackingRunLoopMode. From there, add or update whatever

Re: Updating NSMenu while it's open

2012-04-18 Thread Andy Lee
On Apr 18, 2012, at 9:47 PM, Graham Cox wrote: On 19/04/2012, at 10:04 AM, Jerry Krinock wrote: [...] You must redesign your app to not require refreshing a menu while it is open. Not true - the system's WiFi menu updates while it is open. Another example is the File menu in some apps

Re: Updating NSMenu while it's open

2012-04-18 Thread Dave DeLong
On Apr 18, 2012, at 7:43 PM, Andy Lee wrote: On Apr 18, 2012, at 9:47 PM, Graham Cox wrote: On 19/04/2012, at 10:04 AM, Jerry Krinock wrote: [...] You must redesign your app to not require refreshing a menu while it is open. Not true - the system's WiFi menu updates while it is