Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
referring to @selector
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
jcb  
View profile  
 More options Sep 12 2009, 6:48 pm
From: jcb <jcbu...@gmail.com>
Date: Sat, 12 Sep 2009 15:48:54 -0700 (PDT)
Local: Sat, Sep 12 2009 6:48 pm
Subject: referring to @selector
Okay, I've spent all afternoon in Patrick's JSCocoa files and Gus's
JSTalk source code and examples and my head hurts more than ever.

I want to do this:

[button setAction:@selector(sayHello:window)];

or something the equivalent. Could I get a reference to the selector
with this? (Apparently not.)

var message = NSSelectorFromString(sayHello:window);

And while I'm asking, I'd like to use respondsToSelector, but have the
same problem of specifying a selector.

I bow down to youall in advance. Uh..how might I do that?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ross Boucher  
View profile  
 More options Sep 12 2009, 6:52 pm
From: Ross Boucher <rbouc...@gmail.com>
Date: Sat, 12 Sep 2009 18:52:04 -0400
Local: Sat, Sep 12 2009 6:52 pm
Subject: Re: referring to @selector
Just guessing here, but unless that's pseudo code, you aren't passing  
a string to NSSelectorFromString. Also, this isn't a valid selector:  
@selector(sayHello:window). You're either missing a : after window, or  
you are trying to pass an argument using @selector() which doesn't work.

-Ross

On Sep 12, 2009, at 6:48 PM, jcb wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Patrick Geiller  
View profile  
 More options Sep 12 2009, 7:40 pm
From: Patrick Geiller <parman...@gmail.com>
Date: Sun, 13 Sep 2009 01:40:23 +0200
Local: Sat, Sep 12 2009 7:40 pm
Subject: Re: referring to @selector

Hello JC,

> Okay, I've spent all afternoon

Why do that ? If you hit a wall after a half hour, send a mail.

> [button setAction:@selector(sayHello:window)];

When using selectors with JSTalk or JSCocoa, just use Javascript  
strings and they will be automatically converted.

Use
        [button setAction:'sayHello:']
or (Methods starting with 'set' and taking one argument can be called  
like this)
        button.action = 'sayHello:'

respondsToSelector works the same way :

        if ([button respondsToSelector:'sayHello:'])

As Ross said, you can't pass arguments with these. Selectors are just  
method names.

-Patrick


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jcb  
View profile  
 More options Sep 12 2009, 8:19 pm
From: jcb <jcbu...@gmail.com>
Date: Sat, 12 Sep 2009 17:19:57 -0700 (PDT)
Local: Sat, Sep 12 2009 8:19 pm
Subject: Re: referring to @selector
Thanks, merci, thanks. Yeesh. I think I just get confused by all the
layers of scripting-like stuff atop each other. The simplest solution
is often the real one.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »