Re: Calling a handler from another script
Re: Calling a handler from another script
- Subject: Re: Calling a handler from another script
- From: Shane Stanley <email@hidden>
- Date: Wed, 24 Jun 2015 09:43:14 +1000
On 24 Jun 2015, at 7:01 am, Stan Cleveland <email@hidden> wrote:Is the failure because the subclass script is passing the parameter as (I'm guessing) a CFString?
It is being passed as an NSString, but that's not the issue -- you're passing it to a method that wants an NSString anyway.
There are a couple of things. First, you can't make a subclass of an AS-based class. It doesn't generate an error, but there's no inheritance -- your second class ends up just another subclass of NSObject.
But the clue is in the error message:
Ctrlr[4168:303] *** +[CtrlrAppDelegate buttonSetImage:]: unrecognized function setImage_. (error -10000)
See the + sign? That means you are addressing the CtrlrAppDelegate *class*, calling a class method. And that's what your code shows, too. But in a class, properties are meaningless, so myButton will have no value -- hence the problem with setImage_. You want to address your *instance* of CtrlrAppDelegate. So you need a property that refers to the CtrlrAppDelegate instance, or you can also address it like this:
tell current application's NSApp's delegate()'s to buttonSetImage_("Green")
(You don't need the extension for named images.) |
_______________________________________________
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