Re: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I
Re: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I
- Subject: Re: NSTextField, NSTextFieldCell, NSTextView... this is a mess, I
- From: matt neuburg <email@hidden>
- Date: Thu, 10 Jul 2003 09:51:02 -0700
On Wed, 9 Jul 2003 16:15:41 -0400, Sailor Quasar <email@hidden>
said:
>
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.
Have you heard about NSFormatters? m.
--------
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
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.