Re: What's the difference in these?
Re: What's the difference in these?
- Subject: Re: What's the difference in these?
- From: Phil Stokes <email@hidden>
- Date: Mon, 04 Apr 2016 14:05:34 +0700
On 4 Apr 2016, at 12:57, Brian Christmas < email@hidden> wrote: It’s going to be a PITA to re-write the code
I’m not sure what you’re trying to do, but buttons are for getting information from users (primarily, finding out what they want to do); it doesn’t make sense for you to try to GUI script your own app in order to call your own code.
If you need to call the action method that a button normally calls, you do that from within the code itself. In Cocoa-ObjC (sorry, you’ll have to translate into ASObjc) a method like
- (IBAction)listBtn:(id)sender
could be called from within the same class with
That assumes that you don’t actually need info from the sender and that the receiver will accept a nil value (it will, unless you’ve specified otherwise in the receiver’s code).
If you need to send a value, then you’ll have to wrap that in an appropriate object e.g., if you need to send an integer you’ll have to wrap it in an NSNumber object. Also, you’ll need to make sure that the receiver knows how to handle that object. So, suppose my button normally sends a tag and my receiver normally deals with it thus:
- (IBAction)listBtn:(id)sender {
then I’ll have to modify it to handle the possibility that it’s being called in code and I’m sending (for example) an int wrapped in an NSNumber object:
- (IBAction)listBtn:(id)sender {
if ([sender isKindOfClass:[NSNumber class]]) {
i = [sender integerValue];
|
_______________________________________________
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