Re: adding rows to an array-controller managed table atomically
Re: adding rows to an array-controller managed table atomically
- Subject: Re: adding rows to an array-controller managed table atomically
- From: mmalcolm crawford <email@hidden>
- Date: Fri, 10 Feb 2006 16:12:15 -0800
On Feb 9, 2006, at 5:57 PM, R. Matthew Emerson wrote:
When a new row is added, I would like both x and y values to be
supplied before the addition is considered complete, and the row is
sorted into its place. In other words, addition of a row should be
atomic; a "transaction," if you will. Until both fields are filled
in, tab and return should move the editing focus to the other cell
in the row.
[...]
But, I haven't yet thought of a way to get the array controller not
to sort the row into place immediately after a value in the x cell
is entered.
I can't offhand think of a quick and elegant way to switch off
sorting that meets your needs here -- you'd need to keep a track of
what edits have been made and when you want to be satisfied that all
changes have been made...
An alternative approach might be to make addition truly "atomic" by
using a sheet to allow the user to edit the object prior to
insertion. There are several ways to approach this, but one of the
cleanest is to use a peer managed object context for the new object.
This way the user can edit the new object in isolation and discard it
if they wish without affecting the "main" (in a document based
application, the document's) context (in particular, without
affecting its undo stack). I've put an example of this pattern here:
<http://homepage.mac.com/mmalc/CocoaExamples/controllers.html>
It extends the application built in the NSPersistentDocument tutorial
(<http://developer.apple.com/documentation/Cocoa/Conceptual/
NSPersistentDocumentTutorial/>)...
mmalc
_______________________________________________
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