Re: Which sender is which
Re: Which sender is which
- Subject: Re: Which sender is which
- From: "John C. Welch" <email@hidden>
- Date: Fri, 08 Apr 2011 08:29:30 -0400
- Thread-topic: Which sender is which
Just to make sure I'm not getting so wrapped up in dealing with this in only
one way...is there a way other than tracking file location and control and
saving them to application preferences to save/embed a specific image in an
image well/image view that persists across application restarts until
manually changed by the user?
On 4/7/11 5:39 PM, "John Welch" <email@hidden> wrote:
> Okay, so I think I'm seeing the problem.
>
> I had, per chapter 10 of shane's book, created a subclass of NSImageView to
> handle certain things, like getting the URL of the file. However, if I did
> that, I couldn't set up the drag info as you did with your sample code to
> get the sender info. But, I could get the fURL info from it.
>
> So, on a lark, I stopped pointing the image wells at the subclass, and put
> the code in the subclass in the main script. Okay, so now I can connect
> everything up, and I get the the right info when I log things.
>
> But the URL code blows up. Here's the code:
>
> on performDragOperation_(sender)
> tell current application's NSImage to set picTypes to imageTypes()
> log picTypes
> set thePasteboard to sender's draggingPasteboard()
> set theClasses to {current application's |NSURL|}
> set theOptions to
> {NSPasteboardURLReadingContentsConformToTypesKey:picTypes}
> tell thePasteboard to set imageURLs to
> readObjectsForClasses_options_(theClasses, theOptions)
> set theURL to item 1 of (imageURLs as list)
> set theTag to sender's |tag|
> if sender is pathDataTop then
> log "top"
> else if sender is pathDataRight then
> log "right"
> else if sender is pathDataLeft then
> log "left"
> else
> log "none of the above"
> end if
> log theURL
> return true
> end performDragOperation_
>
> As soon as it gets to the set thePasteboard to sender's draggingPasteboard()
> line, I get:
>
> 2011-04-07 17:32:56.242 Derby Score[3532:903] *** -[Derby_ScoreAppDelegate
> performDragOperation:]: -[NSImageView draggingPasteboard]: unrecognized
> selector sent to instance 0x2008b02e0 (error -10000)
>
> Which really doesn't make sense, because in the examples I found on
> macscripter and elsewhere, that line should work. And yet, it generates that
> error. The first two lines work, and if I comment out all the fURL getting'
> code, I can see which image well I used.
>
> This is getting confuuuuusing.
--
Some people are like Slinkies - They serve no useful purpose, but they do
give you a smile when you push them down a flight of stairs.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden