Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Re: Subclassing NSTableView[Solved]



Yes, that is exactly what I do, just one column.

Peter

Ursprungligt meddelande

> > This doesn't look right to me. Your data source should be an array of
> > dictionaries, not an array of cell contents. Also, this code you
> > provide makes no reference to the table column. I don't understand
> > how this could possibly work.
>
> Maybe his table consists of just one column. If so, then there's no
> need to get the table column's name and translate it into a dictionary
> key. I use one-column tableviews with simple NSArray sources quite
> frequently.
>
> Best regards,
>
> (another) Peter.
>
> > At the most basic level, your
> > -tableView:setObjectValue:forTableColumn:row: method should look
> > something like:
> >
> > - (void)tableView:(NSTableView*)table setObjectValue:anObject
> > forTableColumn:(NSTableColumn *)col row:(int)rowIndex
> > {
> > NSParameterAssert(rowIndex >= 0 && rowIndex < [myTableData count]);
> > [[myTableData objectAtIndex:rowIndex] setObject:anObject forKey:[col
> > identifier]];
> > }
> >
> > -- DTC
> >
> >
> > On 2004 Oct 21, at 19:27, Peter Karlsson wrote:
> >
> >> Just want to tell everyone that it works now but it's very strange.
> >>
> >> This code was missing in my app:
> >>
> >> - (void)tableView:(NSTableView*)table setObjectValue:anObject
> >> forTableColumn:(NSTableColumn *)col row:(int)rowIndex
> >> {
> >> [myMutableArray replaceObjectAtIndex: rowIndex withObject: anObject];
> >> return;
> >> }
> >>
> >> But this code was also missing from the app yesterday that worked. I
> >> have
> >> had no other problems since the project started at least 1 year ago,
> >> all
> >> the time with this code missing. What conclusions can I make from
> >> that? I
> >> really don't know... ;-)
> >>
> >> Peter
> >>
> >> Ursprungligt meddelande
> >>
> >>> Dear list!
> >>>
> >>> Yesterday I subclassed my NSTableView so the user can edit a row and
> >>> press
> >>> return to exit the editing process, everything worked as expected.
> >>> Today I
> >>> did the same thing to another app. But when I have edited the row and
> >> press
> >>> return the text in the row is not changed to the one I have typed. It
> >>> changes back to the text that was in the row before the editing took
> >> place.
> >>> Can someone tell me what's going on here? Very strange...
> >>>
> >>> Best regards Peter
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
>
> This email sent to email@hidden
>

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.