How does Apple update the Airport menu while it is open? (How to change NSMenu when it is already open)

Menu mouse tracking is done in a special run loop mode (NSEventTrackingRunLoopMode). In order to modify the menu, you need to dispatch a message so that it will be processed in the event tracking mode. The easiest way to do this is to use this method of NSRunLoop: [[NSRunLoop currentRunLoop] performSelector:@selector(updateTheMenu:) target:self argument:yourMenu order:0 modes:[NSArray … Read more

Gap above NSMenuItem custom view

Your post is tagged “Objective-C” and “Cocoa”, although your sample code is C and Carbon. I assume you’d prefer a Cocoa solution? It’s actually pretty simple in Cocoa. The only trick is learning how to draw outside the lines. 🙂 @interface FullMenuItemView : NSView @end @implementation FullMenuItemView – (void) drawRect:(NSRect)dirtyRect { NSRect fullBounds = [self … Read more