Re: NSNumber pointerValue
Re: NSNumber pointerValue
- Subject: Re: NSNumber pointerValue
- From: Glenn Andreas <email@hidden>
- Date: Thu, 20 Nov 2003 09:16:01 -0600
At 7:56 AM +0100 11/20/03, Bjvrn Carlstrvm wrote:
Yes, I have. The reason I use NSNumber is that I
want to put several of these into a propertyList
on the pasteboard. NSValue can't do that.
Well, a pasteboard is used to allow communication
of data between processes via copy & paste (and
search strings, etc...).
It also can be used with the same process (but
you can do other things for "private"
pseudo-pasteboards and only convert the data to
the share process when you switch to another
application - pretty common back in the "good old
days").
Drag and drop is implemented using a pasteboard.
Just like you can keep a private
"pseudo-pasteboard" for copy & paste, just use a
private drag & drop pseudo-pasteboard (which can
be as simple as a global variable) for drag &
drop within your application. Since you are
already adding some sort of private data type to
the drag & drop pasteboard, just don't have any
content there, essentially just have a tag that
says "drag & drop my own private data" and in the
reciever of the drop look at the data types
available, and if you find your private type,
instead of retrieving the value from the
pasteboard, get it from your global.
Alternately, if that doesn't seem object oriented
enough, create a special class for your data that
can be archived and uniquely de-archived (it
could be something as simple as encoding the
pointer, but that could run into problems with
saving the pasteboard to some temporary location,
and then bringing it back later when the original
data is out of scope), put that on the pasteboard
(if your data is already implemented as an
object, implement the NSCoding protocols).
--
Glenn Andreas email@hidden
Theldrow, Blobbo, Cythera, oh my!
Be good, and you will be lonesome
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.