Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem (SOLVED)

2009-03-04 Thread Mark D. Gerl
On Mar 4, 2009, at 5:03 PM, Nick Zitzmann wrote: Yes; I pointed that out to you yesterday. You can, if you wish, turn on the warnings/errors option for your target in Xcode to treat all warnings as errors. You should also set a global breakpoint on objc_exception_throw so you can catch exce

Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem (SOLVED)

2009-03-04 Thread Nick Zitzmann
On Mar 4, 2009, at 2:53 PM, Mark D. Gerl wrote: DOH! Spelling error. I never noticed the wee warning triangle next to the call - I spelled "delegate" wrong. I do miss C++ compiler errors! Serves me right for not looking closer at the runlog: Yes; I pointed that out to you yesterday. Y

Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem (SOLVED)

2009-03-04 Thread Mark D. Gerl
On Mar 3, 2009, at 2:30 PM, Mark D. Gerl wrote: // *** DOING this causes the menu to NOT pop down *** [menu setDeligate:menuController]; DOH! Spelling error. I never noticed the wee warning triangle next to the call - I spelled "delegate" wrong. I do miss C++ compiler er

Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem

2009-03-04 Thread Andy Lee
On Mar 3, 2009, at 2:30 PM, Mark D. Gerl wrote: SampleController *menuController = [[[SampleController alloc] init] autorelease]; [menu setAutoenablesItems:NO]; NSMenuItem *it

Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem

2009-03-04 Thread Nick Zitzmann
On Mar 4, 2009, at 9:42 AM, Mark D. Gerl wrote: Any ideas??? I'm still stuck. I already pointed out several problems with your code. But let me show you what worked for me: NSMenu *statusMenu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init] autorelease]; _statusItem = [[[

Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem

2009-03-04 Thread Mark D. Gerl
On Mar 3, 2009, at 2:30 PM, Mark D. Gerl wrote: On Mar 3, 2009, at 11:52 AM, Nick Zitzmann wrote: Can you please show your code? I've done this before, and it worked when I tried it. SURE, see below. I should point out that I've also tried implementing other delegate methods, with no luc

Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem

2009-03-03 Thread Michael Ash
On Tue, Mar 3, 2009 at 4:30 PM, Quincey Morris wrote: > On Mar 3, 2009, at 12:50, Nick Zitzmann wrote: >> It doesn't seem to be documented, but I think it will return nil only if >> (1) there was not enough contiguous RAM in the program's VM space to >> allocate the object, or (2) there was, but t

Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem

2009-03-03 Thread Quincey Morris
On Mar 3, 2009, at 12:50, Nick Zitzmann wrote: On Mar 3, 2009, at 1:33 PM, Quincey Morris wrote: I don't know of any documented API contract that says [NSMenu initWithTitle:] never fails, so checking the returned value seems prudent. In the case of Apple's documentation, it's the other wa

Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem

2009-03-03 Thread Nick Zitzmann
On Mar 3, 2009, at 1:33 PM, Quincey Morris wrote: I don't know of any documented API contract that says [NSMenu initWithTitle:] never fails, so checking the returned value seems prudent. In the case of Apple's documentation, it's the other way around. Unless the documentation mentions th

Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem

2009-03-03 Thread Quincey Morris
On Mar 3, 2009, at 11:47, Nick Zitzmann wrote: // build NSMenu by HAND NSMenu *menu = [[[NSMenu alloc] initWithTitle:@"abc"] autorelease]; if (menu != NULL) You don't have to worry about this. There are a few classes that may return nil (not NULL) if initialization fails, such as NSPipe. N

Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem

2009-03-03 Thread Nick Zitzmann
On Mar 3, 2009, at 12:30 PM, Mark D. Gerl wrote: [statusItem setMenu:theMenu]; Why are you setting the menu twice? This step might be redundant. [statusItem setEnabled:YES]; This line is redundant and can probably be taken out. // build NSMenu by HAND NSMenu *menu = [[[NSMenu alloc] ini

Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem

2009-03-03 Thread Mark D. Gerl
On Mar 3, 2009, at 11:52 AM, Nick Zitzmann wrote: Can you please show your code? I've done this before, and it worked when I tried it. SURE, see below. I should point out that I've also tried implementing other delegate methods, with no luck. And, I've tried setting the menu's delegate

Re: Can't get setDelegate to work on NSMenu attached to NSStatusItem

2009-03-03 Thread Nick Zitzmann
On Mar 3, 2009, at 7:27 AM, Mark D. Gerl wrote: So, I need to tap into some NSMenu events - most notably the menuNeedsUpdate: delegate method. However, when I call the setDelegate: of my NSMenu that's attached to my NSStatusItem, the icon shows, and highlights when clicked, but the menu ne

Can't get setDelegate to work on NSMenu attached to NSStatusItem

2009-03-03 Thread Mark D. Gerl
I have a working NSStatusItem installed with a menu. I need to dynamically alter that menu before it's presented. I'm trying to do something along the lines of what the airport menu does (try option- clicking on it). So, I need to tap into some NSMenu events - most notably the menuNeedsU