Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!usc!ucsd!ucbvax!agate!shelby!daemon From: shiffman@sumex-aim.stanford.edu (Smadar Shiffman) Newsgroups: comp.sys.next Subject: re: Question about Objective-C's @selector Message-ID: <2215@shelby.Stanford.EDU> Date: 17 Jul 90 16:54:06 GMT Sender: daemon@shelby.Stanford.EDU Lines: 23 In article <26a20030.3d07@petunia.CalPoly.EDU> mdeale@vega.acs.calpoly.edu (Myron Deale) writes: >I have something like > >[listObject makeObjectsPerform:(SEL)aSelector with:anObject]; > >but can "aSelector" only be a constant? > >I have a radio button matrix that inputs a choice between a number of >different methods. I would like to set some kind of pointer (ala C's >pointer to function), based upon the radio button input, though >aSelector would have to be a variable rather than a constant literal. You could use [listObject makeObjectsPerform:sel_getUid(radioButtonInput) with:anObject]; where the Objective-C run-time function sel_getUid(radioButtonInput) converts the string radioButtonInput to a selector at run time. Hope this helps, Smadar -------