Re: Set up an editable view based NSTableView programmatically - how to?
Re: Set up an editable view based NSTableView programmatically - how to?
- Subject: Re: Set up an editable view based NSTableView programmatically - how to?
- From: Peter <email@hidden>
- Date: Wed, 08 Jan 2014 01:17:07 +0100
Great! Yes, this helps immensely. Thank you very much!
It didn’t occur to me that it is possible to mix the bindings and data source approaches.
In order not to waste more time and get my job done, I took resort to a double click method copying the data to be edited to an NSTextField, whose action methods feeds the edited value back into the data source. Works very nicely and fits my bill even better than inline editing.
Still, your proof of concept is extremely useful!
Am 08.01.2014 um 01:01 schrieb Willeke <email@hidden>:
>
> Op 7 jan 2014, om 16:52 heeft Peter het volgende geschreven:
>
>> I’d actually prefer to use bindings, but my first column should simply display the row numbers
>
> After some experimenting I managed to create a simple editable view based table view with row numbers, using bindings except for the row number. The row number is in a column with identifier "RowNumber". I implemented this delegate method:
>
> - (NSView *)tableView:(NSTableView *)tableView
> viewForTableColumn:(NSTableColumn *)tableColumn
> row:(NSInteger)row
> {
> NSTableCellView *result = [tableView makeViewWithIdentifier:[tableColumn identifier] owner:self];
> if ([[tableColumn identifier] isEqualToString:@"RowNumber"])
> result.textField.objectValue = [NSNumber numberWithInteger:row];
> return result;
> }
>
> That's all.
> This is the first time I used a view based table view and it looks too simple but maybe it helps.
>
> Willeke
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden