| From | Sent On | Attachments |
|---|
| Subject: | Re: "undefined selector" from NSMenuItem action | |
|---|---|---|
| From: | David Kocher (dkoc...@cyberduck.ch) | |
| Date: | Jan 16, 2010 5:56:02 am | |
| List: | net.java.dev.rococoa.users | |
Refine Search
| From | Sent On | Attachments |
|---|---|---|
| Harald Kuhr | Jan 16, 2010 5:12 am | |
| David Kocher | Jan 16, 2010 5:56 am | |
| Harald Kuhr | Jan 16, 2010 6:24 am |
| Subject: | Re: "undefined selector" from NSMenuItem action | |
|---|---|---|
| From: | David Kocher (dkoc...@cyberduck.ch) | |
| Date: | Jan 16, 2010 5:56:02 am | |
| List: | net.java.dev.rococoa.users | |
Hello Harald,
Have a look at the thread titled 'Mapping Selector as return value' dating from
29. Mai 2009. It discusses the same issue and a possible workaround.
-David
On 16.01.2010, at 14:12, Harald Kuhr wrote:
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,
-- Harald K

