• 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: Field editor delegate doesn't work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Field editor delegate doesn't work


  • Subject: Re: Field editor delegate doesn't work
  • From: Daryn <email@hidden>
  • Date: Mon, 7 Jul 2003 23:20:00 -0500

Although your question has been already been answered (albeit tersely), I'll eleborate so you understand the interactions -- at least as well as I've come to understand them.

Generally, there is only one field editor for an app unless a window delegate's windowWillReturnFieldEditor:toObject: is implemented to return more than one. The delegate of the field editor is the control being edited.

That being said, the folly in your approach is that since the field editor is being frequently reused, setting the delegate at a specific point in time will be negated when a control configures the field editor for its own use.

What you really want is to set your object to be the delegate of the control.

On Monday, July 7, 2003, at 09:44 PM, Sailor Quasar wrote:

I have an NSTextField in an NSWindow (natch :). In the window controller's awakeFromNib: method, I call [[window fieldEditor:YES forObject:textField] setDelegate:self]. I then in that same controller have an implementaion of -textView:shouldChangeTextInRange:replacementString:. The method is never called. I've verified this by placing an NSLog() at the top of the method, and I get nothing. How can I intercept key events relevant to the NSTextField in my window? Aside, of course, from my current horrible hack that subclasses NSApplication and overrides -sendEvent: to intercept NSKeyDown events and pass them on manually... I know, I could have just subclassed NSWindow's -sendEvent:, but at the time I hadn't done enough research into the event system to quite realize that :). In either case, I'd rather avoid subclassing altogether by using the delegate method. Modularity! Why require support from an NSApplication or NSWindow subclass to do something that can be done in window controller without even subclassing NSTextField?

-- Sailor Quasar, just another player in The World
"Come with me in the twilight of the summer night for awhile"
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.


Daryn
_______________________________________________
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.

References: 
 >Field editor delegate doesn't work (From: Sailor Quasar <email@hidden>)

  • Prev by Date: Re: gcc 3.3, Precompiled Headers and Project Builder
  • Next by Date: Re: [OT][PB] ( x = y ) warning - switch behavior
  • Previous by thread: Re: Field editor delegate doesn't work
  • Next by thread: NSFileWrapper Bug/Problem
  • Index(es):
    • Date
    • Thread