• 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: cell respond to key events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cell respond to key events


  • Subject: Re: cell respond to key events
  • From: Daniel Jalkut <email@hidden>
  • Date: Thu, 17 Feb 2005 22:13:59 -0800

Hi Brad - a cell cannot have focus. Only views can have focus. If you have a cell that appears to have focus, it's because the field editor view actually has focus.

If you want to have focus, accept events, whatever, then you should be an NSView instead of a cell. If that seems highly inappropriate for your case, perhaps you should subclass NSMatrix and pass the keydown events from your NSMatrix to the custom cell as desired.

Daniel

On Feb 17, 2005, at 8:54 PM, Brad Miller wrote:

Is it possible to trap key events in an NSCell and if so, how? I'm running around in circles on something that doesn't seem like it should be hard. I have a subclass of NSButtonCell that defines 3 or 4 states and displays a different image based on the state. What I want to do is make is so that if the cell has focus (the view is an NSMatrix) it will respond to different key events (left arrow is state 1, right arrow is state 2, etc). Is this even possible with a cell?

On a related note, the matrix I have is made up of text field cells. In awakeFromNib I'm swapping one of the rows with my NSButtonCell subclass. Everything works great except for tabbing from a text field cell to button cell. Tabbing works correctly from text cell to text cell, button cell to button cell, and button cell to text cell. Is there any trick in getting the button cell to take focus from the text cell?

Thanks,

Brad

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
sweater.com


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: 
 >cell respond to key events (From: Brad Miller <email@hidden>)

  • Prev by Date: NSTableView and threads...
  • Next by Date: NSView and NSText in command non-GUI app
  • Previous by thread: cell respond to key events
  • Next by thread: NSTableView and threads...
  • Index(es):
    • Date
    • Thread