• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why would sheet's default button not respond to return key?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 18:21:45 +0100

On Tuesday, August 27, 2002, at 03:51 pm, Dan Wood wrote:

I've just checked, and the OK button has a key equiv of \R (return) with no modifiers, it's a push button, the only checkboxes checked are "bordered" (grayed out) and "Enabled".

And the problem is not that the button's action isn't dismissing the sheet -- it works just fine if you press the button with the mouse -- but that the return key is ignored or being "eaten" as Jeremy says. I'm not losing my button event -- just the return key event. And it doesn't matter whether I've clicked on something in the window to make sure it's first responder.

As I suggested before, you need to connect the button to an action method in your controller class - your -ok: method or whatever - which closes the sheet AND ends the modal session.

Connecting it to -performClose in IB won't work properly (if at all). Connecting it to -orderOut instead will reliably close the sheet, but won't end the modal session. And if the modal session doesn't end, the method specified by -didEndSelector: won't get invoked. Use an action method of your own. It's much simpler and more reliable if you're not passing contextInfo.

BTW, I've just tried this out with one of my own apps. Connecting a sheet's 'Done' button to -performClose caused sheet misbehaviour. -orderOut worked better, but caused other bad behaviour in my app due to the continuation of a modal session on a sheet which had closed.
-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.

References: 
 >Re: Why would sheet's default button not respond to return key? (From: Dan Wood <email@hidden>)

  • Prev by Date: Re: Why would sheet's default button not respond to return key?
  • Next by Date: Re: Mouse entered and exited events
  • Previous by thread: Re: Why would sheet's default button not respond to return key?
  • Next by thread: Re: Why would sheet's default button not respond to return key?
  • Index(es):
    • Date
    • Thread