• 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: Key event handling theory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Key event handling theory


  • Subject: Re: Key event handling theory
  • From: Greg Titus <email@hidden>
  • Date: Fri, 4 Jan 2002 14:25:44 -0800

On Friday, January 4, 2002, at 01:40 PM, Brian Webster wrote:
OK, so does that mean that there's no "automatic" way to bind keys to selectors, like by loading a key binding dictionary ala Project Builder? That is, to create a new binding (e.g. for Shift-Return), I would need to do that in interpretKeyEvents:? Also, I don't suppose the default key bindings are documented anywhere (aside from digging through the unicode values in the StandardKeyBinding.dict file), are they?

No, I just thought you wanted to avoid a global change. Overriding -interpretKeyEvents: to add the binding in a single class would make shift-return do something different only in that class. Creating a binding for shift-return to a new selector in a key binding dictionary will set it for the whole application or globally -- which may be a good thing or may be a bad thing depending on your intention. If you bind shift-return to -frob:, for instance, then I think what will happen is that it will work fine in your view as long as you just implement -frob:, but I'd expect that NSTextView's would then do nothing when you hit shift-return in them (since they don't have a -frob: method) instead of acting like a normal return. That's just a guess though - I haven't actually tried it.

As far as finding the default key bindings, I just implement -doCommandBySelector:, put a breakpoint on it, and see what selector it gets called with when I try my keystroke. :-)

Hope this helps,
--Greg


  • Follow-Ups:
    • Re: Key event handling theory
      • From: Brian Webster <email@hidden>
References: 
 >Re: Key event handling theory (From: Brian Webster <email@hidden>)

  • Prev by Date: Newbie question on NSControl
  • Next by Date: Re: OOP Clarification
  • Previous by thread: Re: Key event handling theory
  • Next by thread: Re: Key event handling theory
  • Index(es):
    • Date
    • Thread