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 PROTECTED]



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to