I'm building an app that has two NSTextFields (prob'ly more before I'm done). Each of these text fields does word splitting according to different criteria (comma, optional space for one, and whitespace for the other). One of them counts the words and checks case-insensitive for dups. The other just does the duplicate checking.
How it's implemented now is that I have a separate controller for each field and the NSTextField delegates to that controller because for each character, I need to: - dup-check and possibly count - change a label to show the count and any dup alerts - watch for control:completions:forPartialWordRange and provide a custom list This seems like boneheaded code duplication, when what I really want is a more general class that can be told: Hey! This NSTextField needs to be watched for dups, so split on [\s*,\s*] and each time a new word shows up, call my method: theresANewWord:count withDuplicates:dups. That suggests to me that subclassing NSTextField and allowing a single controller to register a callback would be the right way to go, but I'm struggling with how to specify *which* text field and whether my design idea is even sound. Any help is appreciated. Thanks, --steve_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com