• 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: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I need help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I need help


  • Subject: Re: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I need help
  • From: Sailor Quasar <email@hidden>
  • Date: Thu, 10 Jul 2003 22:05:58 -0400

On Thursday, July 10, 2003, at 05:22 PM, Alastair J.Houghton wrote:
The process of intercepting keystrokes that go to a single text field without subclassing the application or window is proving far more complex than it ought.
Just out of curiosity, why are you trying to intercept keystrokes? I only ask because on Windows this is often the way people go about limiting the types of data that can be entered into edit controls (and often they miss the fact that they have to deal with cut, copy, paste etcetera when they do this ;->). If you are trying to do that, then I think you should be looking at the NSFormatter class instead.

I need to intercept two keystrokes (option-up and option-down), as well as the sending of the field's action, to implement a history for a command input area. I've successfully implemented it using a subclass of NSWindow and of NSTextField, but I'm very unhappy with the violation of enscapulation principles that comes with that. I'd much rather have just the field responding to the keys, but the text input architecture means I either have to trap sendEvent in the field's window (not its delegate, the window itself!) or replace the field's field editor (again, not the delegate). I've had zero success with the latter, due mostly to poor documention on what's really going on inside those things. NSFormatter is a good idea, but unfortunately is never asked about keystrokes involving the arrow keys so can not handle what I need. (I've run tests to verify this).

-- Sailor Quasar, guardian of Leraz's memory
"A face of stone may hide a soul with the deepest Love of all"
Email: email@hidden
_______________________________________________
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.

  • Follow-Ups:
    • Re: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I need help
      • From: Daryn <email@hidden>
References: 
 >Re: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I need help (From: "Alastair J.Houghton" <email@hidden>)

  • Prev by Date: /Library/Preferences
  • Next by Date: Re: moving breakpoints
  • Previous by thread: Re: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I need help
  • Next by thread: Re: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I need help
  • Index(es):
    • Date
    • Thread