Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

passing arguments to a selector?

Thread view: 
Georg J. Stach - 09 Mar 2006 00:44 GMT
Hello,

I have a simple method declared like this:

- (void) testMe: (int) n;

For testing reasons, this doesn't anything more than printing out the value
of its argument (n).

In the main method I declare a SELector referring this method:

SEL mySEL = @selector(testMe:);

Now let's assume I want to call testMe(5). But instead of calling the method
directly, I want to use the selector mySEL. How is this done?

If I try something like this  ( a is an object responding to testMe: )

[ a perform: mySEL:5 ];

the compiler yields that the object a does not respond to perform::, which
is actually right but shows me that the colon is not interpreted as
argument for the selector but for "perform".

So, how to pass arguments to a selector?

Kind regards
Georg
John C. Bollinger - 09 Mar 2006 03:20 GMT
> I have a simple method declared like this:
>
[quoted text clipped - 17 lines]
> is actually right but shows me that the colon is not interpreted as
> argument for the selector but for "perform".

Presumably someone around here will recognize the language you're using,
but it isn't Java, and this is comp.lang.JAVA.programmer.  You are
likely to get more and better answers if you direct your question to a
more appropriate forum.

Signature

John Bollinger
jobollin@indiana.edu

Chris Uppal - 09 Mar 2006 10:34 GMT
> [ a perform: mySEL:5 ];

If this is Objective-C then you might be better off asking in either
   comp.lang.objective-c
or one of the mac programming groups:
   comp.sys.mac.programmer.*

   -- chris
Georg J. Stach - 09 Mar 2006 16:49 GMT
I'm sorry,

during sending the question, my newsreader was in this group, just one above
objective-c...

Georg
John C. Bollinger - 10 Mar 2006 04:00 GMT
> If this is Objective-C

[...]

Ah, Mr. Presumably Someone Around Here, himself.  :-)

I didn't want to name names, but I /was/ thinking of you in particular
when I wrote that bit of my response.  Good show!

Signature

John Bollinger
jobollin@indiana.edu

Chris Uppal - 10 Mar 2006 09:26 GMT
> > If this is Objective-C
>
[quoted text clipped - 4 lines]
> I didn't want to name names, but I /was/ thinking of you in particular
> when I wrote that bit of my response.  Good show!

<blush/>

   -- chris


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.