Hello,

I have three token fields, each of which has a special case within

- (NSArray *)tokenField:(NSTokenField *)tokenField
completionsForSubstring:(NSString *)substring
                   indexOfToken:(int)tokenIndex
        indexOfSelectedItem:(int *)selectedIndex

for when one of the fields contains a value vs when one does not.

For Example..

If Field 1 contains a value

Then Field 2 bases its completions off a sub-set of data based on the
value from Field 1.

Like so:

=================
---Field 1 (Group X)
-----Field 2 (Users only from Group X)

Or

---Field 1 (Empty)
-----Field 2 (Users from All Groups)
=================

Also - (id)tokenField:(NSTokenField *)tokenField
representedObjectForEditingString: (NSString *)editingString

returns the corresponding object for each NSTokenField(Cell?).

------------
Problem:
------------

Whenever a value is entered into Field 1, then Field 2 searches based
off it. Whenever a value is removed from Field 1, or Field 2, or both,
Field 2 now ALWAYS searches based on the data that WAS in Field 1 (but
is no longer.) This still occurs even if I [ TokenField
setStringValue:@"" ]; .  From the UI perspective, the Field 1 token
field is empty, even programatically setting the field to be an empty
string, completionsForSubstring still acts as though there is a value
in Field 1, and follows the corresponding code path.

Here is how I check to see if there is a value in the field

if( [ [ TokenField objectValue ] count ] > 0 )

It works fine if I close the window & reopen it. But once a value is
committed to any field, it has the residual effect of impacting all
future completionsForSubstring, by effectively limiting the results to
only include Users from Group X, even when Field 1 is now "empty"
_______________________________________________

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

Reply via email to