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

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


  • Subject: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I need help
  • From: Sailor Quasar <email@hidden>
  • Date: Wed, 9 Jul 2003 16:15:41 -0400

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. So far I've determined that to do this while keeping an instance variable for use by the text field, I must:

1) Create a subclass of NSTextField whose +cellClass method returns the class of my NSTextFieldCell subclass and whose -sendAction method handles my every-action code.
2) Create a subclass of NSTextFieldCell that contains the instance variable in question, overrides -setUpFieldEditorAttributes to return an instance of my NSTextView subclass, and defines some methods for that subclass.
3) Create a subclass of NSTextView whose -keyDown method actually Does the key processing (two option keys, that's all I want to trap) and send messages back to the cell when necessary to access the instance variable.

This seems like a horrifically complicated mess.... and after figuring it all out in accordance with the docs, it doesn't work. The text field's new cell is created but never actually shows anything. -setUpFieldEditorAttributes is never called. There must be SOME way to deal with this; it's making the MVC model impossible to maintain.

Did someone say use delegates? No good, I need to intercept the keys and action messages BEFORE the darned field sees them, and textView:shouldChangeTextInRange: isn't accessible I'm told.

Alternatively, a way to add to the key bindings dictionary progmatically would be just fine too, but I can't even find that in the docs!

-- 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: "Alastair J.Houghton" <email@hidden>
  • Prev by Date: SMySQL and @class
  • Next by Date: How to send a mail from within a program
  • Previous by thread: Re: SMySQL and @class
  • Next by thread: Re: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I need help
  • Index(es):
    • Date
    • Thread