Re: NSSecureTextFieldCell in NSTableView
Re: NSSecureTextFieldCell in NSTableView
- Subject: Re: NSSecureTextFieldCell in NSTableView
- From: Eric Long <email@hidden>
- Date: Fri, 26 May 2006 11:03:21 -0700
>
>> Searching around, I've seen messages indicating others have encountered the
>> problem I am seeing, but I did not find an explanation of why or a solution
>> to the problem.
>>
>> I'm using bindings with a table view. I set it all up and it worked nicely.
>> But, I wanted to change the data cell for one of the columns to an
>> NSSecureTextFieldCell, so I did. Well, now any time you edit a value in
>> that column it doesn't take. Just disappears immediately when you commit
>> the editing, like it never happened.
>>
>> If I change the column data cell back to a regular NSTextFieldCell,
>> everything is happy again.
>>
>> Does anyone have a bead on this problem?
>
> FWIW, given that no one else seems to have any thoughts about how to deal
> with this issue, I've logged bug 4556320 in radar concerning it.
I'm told Apple Engineering is looking into my report. For anyone else who
might be dealing with this same problem, here is how I've been advised to
work around the problem:
>
> The easiest workaround is probably simply to unbind the column with the secure
> textField and handle it the "old fashioned" way. We'll let Bindings still take
> care of the rest.
So:
1. Unbind the table column. Set the tableColumn identifier to something
like "properties.secretInfo".
2. Set the table data source to your controller.
3. Add appropriate data source methods to your controller:
- (int)numberOfRowsInTableView:(NSTableView *)aTableView {
return [[secretItemsArrayController arrangedObjects] count];
}
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
NSString *keyPath = [aTableColumn identifier];
if (![keyPath isEqualToString:@"properties.secretInfo"])
return nil;
else
return [[[ secretItemsArrayController arrangedObjects]
objectAtIndex:rowIndex] valueForKeyPath: keyPath];
}
- (void)tableView:(NSTableView *)tableView setObjectValue:(id)object
forTableColumn:(NSTableColumn *)tableColumn row:(int)row
{
NSString *keyPath = [tableColumn identifier];
if ([keyPath isEqualToString:@"properties.secretInfo"])
[[[ secretItemsArrayController arrangedObjects]
objectAtIndex:row] setValue:object forKeyPath: keyPath];
}
Other bindings will continue to do their thing and things should just work.
Hope this helps someone else.
Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden