Re: NSInvocation question
Re: NSInvocation question
- Subject: Re: NSInvocation question
- From: Hank Heijink <email@hidden>
- Date: Wed, 27 Feb 2008 10:58:27 -0500
On Feb 25, 2008, at 6:03 PM, Chris Suter wrote:
Why don't you just do something like I suggested in my previous e-
mail:
For every callback you have, write a method on MyDocument:
For example:
- (void)doStartTrial
{
[self startTrial:trial]; // Store trial as an instance variable of
MyDocument
}
- (void)doMakeGraphic
{
[self makeGrahpic:graphic changeStatusTo:status]; // Likewise,
store graphic and status as instance variables
}
Now just pass the selector round for the callback, so that when you
want to trigger the callback, you just do:
[self performSelector:selector];
I don't follow you here. Say I have 10 trials to run and I have trial
as an instance variable of MyDocument. I then have to increment the
instance variable before every call to doStartTrial. That seems more
work than storing the argument as an instance variable of my MVAction
class and making sure I've got the type of the function right.
Worse, in the case of doMakeGraphic, I don't know what the instance
variables should be until the call, since there are many calls to
makeGraphic:changeStatusTo: and their order depends on a complex
interplay of conditions that I have no way of predicting.
I'm sorry if I'm missing your point. In the meantime, I'll stick to my
NSInvocations...
Thanks very much for your help!
Hank
Hank Heijink
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden