Submitted the right CPTokenField file, was missing the part to use the delegate approved tokens. Still lacks a way to put the cursor after the last token (if the delegate returns more than one token)

This commit is contained in:
Samir Gartner
2011-09-09 12:48:18 -05:00
parent 043df71185
commit 662b1ec696
+8 -2
View File
@@ -208,8 +208,14 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
[objectValue removeObjectAtIndex:_selectedRange.location];
//confirm with the delegate the token inclusion
if ([[self tokenField:self shouldAddObjects:[CPArray arrayWithObject:token] atIndex:index] count])
[objectValue insertObject:token atIndex:_selectedRange.location];
delegateApprovedObjects = [self tokenField:self shouldAddObjects:[CPArray arrayWithObject:token] atIndex:index];
if (delegateApprovedObjects)
{
for(var i = 0; i < [delegateApprovedObjects count]; i++)
{
[objectValue insertObject:[delegateApprovedObjects objectAtIndex:i] atIndex:_selectedRange.location + i];
}
}
var location = _selectedRange.location;
[self setObjectValue:objectValue];