• 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: Intercepting keyDown event from NSComboBox
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Intercepting keyDown event from NSComboBox


  • Subject: Re: Intercepting keyDown event from NSComboBox
  • From: Jon Hess <email@hidden>
  • Date: Wed, 13 Feb 2008 14:42:41 -0800


On Feb 13, 2008, at 2:29 PM, Randall Meadows <email@hidden> wrote:


On Feb 13, 2008, at 1:41 PM, Kyle Sluder wrote:

On Feb 13, 2008 12:37 PM, John Stiles <email@hidden> wrote:
There are technotes on returning a custom field editor which you can
look at. All you really need to do is subclass NSTextView and implement

Except this is an NSTextFIELD, not -View (well, actually, NSComboBox, but that is an NSTextField).



Something that often surprises new developers is that text fields don't edit themselves. They're edited by a field editor, which is a subclass of NSTextView. You can read about the concept of a field editor in the docs. I would provide a link but I'm composing this on my phone.


Good luck -
Jon Hess

a -keyDown: or -insertText: in your subclass, then provide that text
view as the field editor for the combo box. That should solve it.

I'm still really confused as to why everyone is recommending subclassing the first responder

Which, as I noted, DOESN'T WORK ANYWAY!!! (Go ahead, try it; I'll wait......See?)


instead of catching the event as it
enters the window.  To accomplish your goal, you need to change the
event dispatching logic, which is not a property of the first
responder, but the mechanism that gets the event to it.

Just for the record, that is now what I'm doing; I had subclassed NSWindow anyway, so it was trivial to add the sendEvent: override in there as well. And, it works perfectly; much better than my hack.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Intercepting keyDown event from NSComboBox (From: Randall Meadows <email@hidden>)
 >Re: Intercepting keyDown event from NSComboBox (From: Graham <email@hidden>)
 >Re: Intercepting keyDown event from NSComboBox (From: John Stiles <email@hidden>)
 >Re: Intercepting keyDown event from NSComboBox (From: Randall Meadows <email@hidden>)
 >Re: Intercepting keyDown event from NSComboBox (From: John Stiles <email@hidden>)
 >Re: Intercepting keyDown event from NSComboBox (From: "Kyle Sluder" <email@hidden>)
 >Re: Intercepting keyDown event from NSComboBox (From: Randall Meadows <email@hidden>)

  • Prev by Date: Re: Intercepting keyDown event from NSComboBox
  • Next by Date: Re: NSTokenField bug in 10.5.2?
  • Previous by thread: Re: Intercepting keyDown event from NSComboBox
  • Next by thread: Re: Intercepting keyDown event from NSComboBox
  • Index(es):
    • Date
    • Thread