• 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: Handling keyDown events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling keyDown events


  • Subject: Re: Handling keyDown events
  • From: Aki Inoue <email@hidden>
  • Date: Fri, 5 May 2006 14:12:46 -0700

You can create an object implementing NSControl delegate method, - control:textView:doCommandBySelector:, and set it as the search field delegate.

You can look for moveUp: and moveDown: selectors and change the table view selection accordingly (you can follow Cocoa standard key binding this way).

Btw: I also need to assign to a button the key equivalent CMD- SpaceBar (yes, it's odd!!). But IB don't let me do this.
It's very likely you never see cmd+space events in your event queue. It's used by Spotlight and/or keyboard management.

Aki



If you want to modify the behavior of the arrow keys for the entire window, regardless of which control is active within, my first recommendation would be to not do so as you are invariably going to end up with a UI that works differently than every other Cocoa app on the system.

However, if my guess as to your intentions is wrong -- quite likely given that I have no idea what you are actually trying to achieve -- then you will need to capture the events before they hit the responder chain.

I have a search field and a table (containing search results). I need that when the user press arrow down (in the s.field) the first row in the table gets selected. I know that this makes the interface behaviour non-standard but I just have to do that.
(Standard behaviour require the the user press tab selecting the table and then arrow-down).


What is the key view when you are typing? Is the cursor blinking in a field? If so, then the field is the first responder and is accepting key events.

Yes, it is. So I need to subclass the NSSearchField and override keyDown?


Or should I find I way (studying the Cocoa Events Overview documentation) to catch the keyDown event at the beginning of the responder chain?

I thought that the window was the first object asked to respond events and, if the window doesn't respond then the event is passed to the window's subviews. That's why I subclassed NSWindow.

Btw: I also need to assign to a button the key equivalent CMD- SpaceBar (yes, it's odd!!). But IB don't let me do this.



"<Ai sensi e per gli effetti del D.Lgs. n.� 196/2003 (Codice della Privacy) si precisa che questo messaggio, ed eventuali relativi allegati, � strettamente riservato ai destinatari in indirizzo, con espressa diffida di conservazione, uso, copiatura o divulgazione.
Chiunque lo riceva, non essendone destinatario, � pregato di avvertire lo scrivente e di provvedere alla distruzione di quanto erroneamente pervenuto>"
_______________________________________________
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

_______________________________________________ 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
References: 
 >Handling keyDown events (From: Paolo Bertani <email@hidden>)
 >Re: Handling keyDown events (From: Bill Bumgarner <email@hidden>)
 >Re: Handling keyDown events (From: Paolo Bertani <email@hidden>)

  • Prev by Date: Re: Handling keyDown events
  • Next by Date: Re: How to control the commit of text edit field with binding?
  • Previous by thread: Re: Handling keyDown events
  • Next by thread: NSNumericPadKeyMask & arrow keys
  • Index(es):
    • Date
    • Thread