Re: Strings mangled on generalPasteboard
Re: Strings mangled on generalPasteboard
- Subject: Re: Strings mangled on generalPasteboard
- From: Kevin Walzer <email@hidden>
- Date: Mon, 23 Nov 2009 20:54:54 -0500
- Organization: WordTech Communications LLC
On 11/23/09 7:26 PM, Jens Alfke wrote:
You're looping over all the types on the drag pasteboard, and every time you stuff your resulting 'pasteboardvalue' string into the general pasteboard. Since each iteration overwrites the result of the previous ones, you only end up handling the last type on the pasteboard. I'm not sure exactly what your code is intending to do, but you need to restructure it somehow.
The thing that tends to make the most sense usually is not to loop but to ask the pasteboard for the data for each type you're interested in, the best type first, and then use the first type you get. So in your case you'd probably ask for filenames first, then URLs, then strings.
Basically, what I'm trying to do is implement basic drag support for a
cross-platform GUI library that runs on top of Cocoa (Tk). My approach
is retrieve string data from the drag pasteboard (either a raw string,
an array of file paths, or, if it can be done simply, a URL like
"http://www.apple.com") and dump it to the general clipboard, where it
will be available to Tk. Because of the somewhat generic intent of this
library, I need to support strings and file paths at a minimum. NSURL,
unfortunately, complicates this design more than I would like.
--Kevin
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden