Re: CoreData - placing "references" to objects on the general pasteboard
Re: CoreData - placing "references" to objects on the general pasteboard
- Subject: Re: CoreData - placing "references" to objects on the general pasteboard
- From: mmalcolm crawford <email@hidden>
- Date: Tue, 9 May 2006 08:50:14 -0700
On May 9, 2006, at 8:05 AM, Jim Correia wrote:
NSURL *moURI = [[managedObject objectID] URIRepresentation];
That technique works great for drag and drop, since there is no
[mod save: &error] between populating the pasteboard and receiving
the drop to invalidate any temporary object IDs.
This problem does surface if I want to put object references on the
general pasteboard. (I really do want a reference here, not a
dictionary of attributes, so that the paste location can decide
what to do given the reference to the original.)
Is there a recommended solution to this problem? (If not, I can
arrange for the pasteboard rep to be a unique attribute of the
objects in question, and fetch them at paste time.)
Without testing:
You could just use a "lazy paste". Declare the type, but if the GID
is temporary don't write the data (and obviously keep a reference to
the original MO). In pasteboard:provideDataForType: you then write
the current ID.
The tricky bit is what to do if the GID is still temporary at that
stage; you presumably want to allow for the possibility of future
paste operations, but with the option of an intervening 'save'... so
you will have to re-declare the type on the pasteboard to set up lazy
pasting again, otherwise the pasteboard will retain the temporary
GID. I'm not sure exactly what order you'll have to do this in (I
need to test to see if you're allowed to invoke declareTypes:owner:
during pasteboard:provideDataForType:, or if you'd have to do
something else like a delayed perform).
Would you please file an enhancement request for the documentation.
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