atom feed3 messages in net.java.dev.rococoa.users"undefined selector" from NSMenuItem ...
FromSent OnAttachments
Harald KuhrJan 16, 2010 5:12 am 
David KocherJan 16, 2010 5:56 am 
Harald KuhrJan 16, 2010 6:24 am 
Subject:"undefined selector" from NSMenuItem action
From:Harald Kuhr (hara@gmail.com)
Date:Jan 16, 2010 5:12:26 am
List:net.java.dev.rococoa.users

Hi guys,

I'm hacking again. :-)

And as usual, I'm running into issues I don't understand. I'm tying to modify the standard application menu (and having great success with that). But, the action of an NSMenuItem is always returned as "undefined selector". This happens wether or not I explicitly set the action to a Selector created by Foundation.selector or just try to get the default one. If I replace the target (with a non-conforming object), I'll get an exception that will tell me the correct name of the selector. Is there a bug in Rococoa here?

The NSMenuItem action method is defined as

- (SEL)action

and setAction as

- (void)setAction:(SEL)aSelector

My definitions are:

pubilc abstract Selector action(); public abstract void setAction(Selector s);

The problem is now that for example

item.setAction(item.action());

will make the application crash if that menu item is selected, while it should (effectively) be a no-op, making the menu item do exactly the same as before...

Ideas?

Thanks,