Re: Why would sheet's default button not respond to return key?
Re: Why would sheet's default button not respond to return key?
- Subject: Re: Why would sheet's default button not respond to return key?
- From: Jeremy Dronfield <email@hidden>
- Date: Tue, 27 Aug 2002 14:28:46 +0100
On Monday, August 26, 2002, at 08:33 pm, Dan Wood wrote:
I'm bringing up a sheet from my window, and that sheet has an "OK"
button with a key equivalent of the return key that is supposed to
dismiss the button. The button is throbbing blue, but the return key
doesn't activate the sheet.
Any ideas what might be happening here, or how to diagnose this? I'm
stumped....
BTW, the method I'm using to bring up the sheet is:
[NSApp
beginSheet:oWindow
modalForWindow:inWindow
modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:nil];
Your sheet does NOT have to be an NSPanel. Nor do you need to use a
didEndSelector, since you're not passing any contextInfo. Simply change
both modalDelegate and didEndSelector to "nil", and connect your button
to an action method which contains the following:
[NSApp stopModal];
[NSApp endSheet:oWindow];
[oWindow close]; <= only use this if you've set oWindow to release
when closed. Otherwise it's not needed.
The only thing you need to connect in IB is your button to its action
method. If you find this doesn't work, and that your button event is
being 'eaten', then something somewhere is preventing your sheet
becoming modal. In that case, search elsewhere in your code for the
cause.
-Jeremy
=======================================
email@hidden // email@hidden
The Alchemy Pages:
- fractious fiction at
http://freespace.virgin.net/jeremy.dronfield
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.