• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Set up an editable view based NSTableView programmatically - how to?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Set up an editable view based NSTableView programmatically - how to?


  • Subject: Re: Set up an editable view based NSTableView programmatically - how to?
  • From: Seth Willits <email@hidden>
  • Date: Tue, 07 Jan 2014 16:47:01 -0800

To clarify: this isn't mixing approaches. Willeke isn't using any datasource methods at all.

tableView:viewForTableColumn:row: is a delegate method. The *only* datasource method view-based table views support is the objectValue getter, which simply sets the objectValue property on the view returned by the delegate method, if that view has one. That's it. It's the same as assigning tableCellView.objectValue in that delegate method yourself.


--
Seth Willits



On Jan 7, 2014, at 4:17 PM, Peter <email@hidden> wrote:

> 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;
>> }


_______________________________________________

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


References: 
 >Set up an editable view based NSTableView programmatically - how to? (From: Peter <email@hidden>)
 >Re: Set up an editable view based NSTableView programmatically - how to? (From: Willeke <email@hidden>)
 >Re: Set up an editable view based NSTableView programmatically - how to? (From: Peter <email@hidden>)

  • Prev by Date: Re: Set up an editable view based NSTableView programmatically - how to?
  • Next by Date: NSScrollView problem
  • Previous by thread: Re: Set up an editable view based NSTableView programmatically - how to?
  • Next by thread: Letting an instance know its own index within a container array - how to?
  • Index(es):
    • Date
    • Thread