cappuccino/cappuccino — Issue #1396: CPTokenField does not support Focus or Blur Notifications
Author: walisser
Created: 2011-11-14 15:25:08+00:00
State: open

Is there a reason for this? Since CPTokenField is a subclass of CPTextField it should implement these notifications?

The fix would appear to be simple. As a workaround I have a subclass of CPTokenField that overrides these:

```objective-j
- (BOOL)becomeFirstResponder
{
var become = [super becomeFirstResponder];

if (become)
[self textDidFocus:[CPNotification
notificationWithName:CPTextFieldDidFocusNotification
object:self userInfo:nil]];

return become;
}

- (BOOL)resignFirstResponder
{
// NOTE: this appears to be a BUG in cappuccino

var resign = [super resignFirstResponder];

if (resign)
[self textDidBlur:[CPNotification
notificationWithName:CPTextFieldDidBlurNotification
object:self userInfo:nil]];

return resign;
}
```