• 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
Custom field editors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom field editors


  • Subject: Custom field editors
  • From: John Stiles <email@hidden>
  • Date: Fri, 04 Jan 2008 11:35:38 -0800

I'm looking at creating a custom field editor (so I can filter out keystrokes in various types of controls in a consistent way).
The text editing programming guide has a section called "How to Substitute a Custom Field Editor", with an example snippet which seems nice and simple:


(id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)anObject
{
    if ([anObject isKindOfClass:[NSTextField class]])
    {
        return [[[myCustomFieldEditor alloc] init] autorelease];
    }
    return nil;
}


(Admittedly, there are two problems in the code—no leading hyphen and a lowercase class name—but I'm going to let that slide for now :) )
However, according to the docs for -windowWillReturnFieldEditor:toObject:, this code is actually broken:


Discussion
This method may be called multiple times while a control is first responder. Therefore, you must return the same field editor object for the control while the control is being edited.

This seems to directly contradict the sample code above, so which is correct? I'll happily file it, but I just wanted to run this past someone who might have already been down this road before.
_______________________________________________


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


  • Follow-Ups:
    • Re: Custom field editors
      • From: Aki Inoue <email@hidden>
  • Prev by Date: Selecting an object of a NSArrayController
  • Next by Date: Re: Obj-C and Mac OS BSIT Degree
  • Previous by thread: Re: Selecting an object of a NSArrayController
  • Next by thread: Re: Custom field editors
  • Index(es):
    • Date
    • Thread