Re: NSMenuItem Target Action problem
Re: NSMenuItem Target Action problem
- Subject: Re: NSMenuItem Target Action problem
- From: Joachim Deelen <email@hidden>
- Date: Tue, 24 Jan 2006 20:18:24 +0100
Hi,
thanks a lot. That worked.
I had the following lines of code in my action-method, since editing
does not end when pressing a button:
if([[sender window] makeFirstResponder:[sender window]] == NO) {
[[sender window] endEditingFor:nil];
}
Now I don't do that, if the sender is the NSMenuItem.
- Joachim
Am 24.01.2006 um 20:03 schrieb Camillo Lugaresi:
On 24/gen/06, at 19:59, Joachim Deelen wrote:
Hello,
I have assigned a NSMenu with two NSMenuItems, as a contextual
menu for a NSTableView, using InterfaceBuilder. I've done this, by
connecting the menu outlet of the NSTableView, to the NSMenu and
connecting the NSMenuItems to the corresponding IBAction methods
of my application.
When running the application, the Menu appears correctly, when
ctrl-mouse is pressed. But selecting an Item, produces the
following Exception in the run-log:
The sender of menu item actions is now the NSMenuItem, not an
NSMatrix. A menu item action method appears to be trying to send
the NSMatrix method 'window' to its sender. This is no longer
valid. Please change the code.
2006-01-24 18:02:59.412 StoryCard[1075] *** -[NSMenuItem window]:
selector not recognized [self = 0x366c90]
I think, that IB is "generating" wrong code for this.
The IBAction methods work fine, since I'm using them as actions
for push-buttons also.
I'm using Tiger 10.4.4, Xcode 2.2 and IB 2.5.3 (443)
Any ideas?
Unless the error message is grossly wrong, it seems that you are
calling [sender window] in your action method. Don't do that.
Camillo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden