Re: Which sender is which
Re: Which sender is which
- Subject: Re: Which sender is which
- From: "Bukowinski, Peter" <email@hidden>
- Date: Thu, 07 Apr 2011 20:23:29 +0000
- Thread-topic: Which sender is which
I just threw together a dummy app and I'm getting good results.
Here's my code:
script ImageWellTestAppDelegate
property parent : class "NSObject"
property theFirstWell : missing value
property theSecondWell : missing value
on objectInWell_(sender)
if sender is theFirstWell then
log "first"
else if sender is theSecondWell then
log "second"
else
log "I dunno"
end if
end objectInWell_
on applicationWillFinishLaunching_(aNotification)
-- nothing to see here
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
return current application's NSTerminateNow
end applicationShouldTerminate_
end script
For the interface, I just put a couple image wells into a window. I then
dragged a connection from the app delegate to each well, selecting the
first and second properties, respectively. Then I dragged a connection
back from each to the app delegate, selecting the objectInWell: handler.
My log returns "first" and "second" reliably. I'm using Xcode 4.0.1.
--
Peter
On 4/7/11 3:33 PM, "John C. Welch" <email@hidden> wrote:
>On 4/7/11 2:21 PM, "Bukowinski, Peter" <email@hidden>
>wrote:
>
>> Have you tried the pipes?
>>
>> set theTag to sender's |tag|
>
>Same results as tag sans bars, drat.
>
>>
>> A more straightforward method would be to refer to each image well by
>>its
>> IB-bound property name:
>>
>> if sender is firstImageWell then...
>
>You mean the missing value property that I connected the image well to? If
>so, then this:
>
> 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
>
>Always logs "none of the above"
>
>john
>
>--
>If I wanted to hear the pitter-patter of little feet, I'd put shoes on my
>cat.
>
>Anon.
>
>
>
> _______________________________________________
>Do not post admin requests to the list. They will be ignored.
>applescriptobjc-dev mailing list
>(email@hidden)
>Help/Unsubscribe/Update your Subscription:
>anelia.hhmi.org
>
>This email sent to email@hidden
_______________________________________________
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