• 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: Core Data Insert and editColumn:row:withEvent:select: [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data Insert and editColumn:row:withEvent:select: [SOLVED]


  • Subject: Re: Core Data Insert and editColumn:row:withEvent:select: [SOLVED]
  • From: SA Dev <email@hidden>
  • Date: Fri, 7 Oct 2005 11:05:27 -0400


I'm such an idiot. :-)

The following method works after receiving a notification (where 'acFoo' is the array controller and 'fooView' is the table view):

- (void)renameFoo:(id)foo
{
    int col = [[fooView tableColumns] indexOfObject:columnFooTitle];
    int row = [[acFoo arrangedObjects] indexOfObject:foo];

   [acFoo setSelectionIndex:row];
   [fooView editColumn:col row:row withEvent:nil select:YES];
}

The piece I was missing was [acFoo setSelectionIndex:row] ... It's probably a good idea to tell your array controller to select the object in question since it's responsible for managing the table view's selection too ... ;-)



On Oct 7, 2005, at 9:18 AM, SA Dev wrote:

List:

I have a Core Data app with a table listing "Foo" entity instances (using bindings). Foo has a -title attribute. When a new Foo instance is inserted, I would like the table to begin editing the title column immediately for renaming. The challenge is that the table is in another nib separate from the document's nib and new Foo instances are added in an action in my NSDocument subclass.

I've tried catching NSManagedObjectContextObjectsDidChangeNotification and getting the inserted objects set, then calling - editColumn:row:withEvent:select:, but I ended up having to brute- force updating the table for the row to even be there. This works randomly. The times it doesn't work, the cell goes into edit mode for a split second, then another row is selected ... Someone on cocoadev.com suggested setting a zero-interval timer to get past the current run loop (worth a try), but I get the same results. I realize it's all a matter of timing and that I'm probably fighting the bindings architecture.

What's the best way to accomplish this? I know something similar to this was discussed here: http://www.cocoabuilder.com/archive/ message/cocoa/2005/9/6/145831

... the fact that I'm doing this in a separate nib seems to make all the difference as the example given above doesn't work for me.

  Any help would be most appreciated.

 - SADev

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40silentalcove.net


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: This email sent to email@hidden
References: 
 >Core Data Insert and editColumn:row:withEvent:select: (From: SA Dev <email@hidden>)

  • Prev by Date: using DiskArbitration framework on Panther
  • Next by Date: Re: How to release Cocoa objects from Perl? (PerlObjCBridge or CamelBones)
  • Previous by thread: Core Data Insert and editColumn:row:withEvent:select:
  • Next by thread: using DiskArbitration framework on Panther
  • Index(es):
    • Date
    • Thread