Re: NSInvocation question

2008-02-27 Thread Hank Heijink
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 MyDo

Re: NSInvocation question

2008-02-25 Thread Chris Suter
On 26/02/2008, at 1:49 AM, Hank Heijink wrote: I haven't been very clear, my apologies. I may have completely overlooked the best strategy, so let me try to explain what I'm doing. I have to call methods depending on certain conditions. These include passing of time, movement of the cursor

Re: NSInvocation question

2008-02-25 Thread Hank Heijink
On Feb 25, 2008, at 3:49 PM, Nir Soffer wrote: The docs don't tell if -invokeWithTarget: will retain the target, so call -setTarget:nil after invoking to be sure you don't create a retain cycle. As far as I understand the documentation, -[invokeWithTarget:] is equivalent to -[setTarget:]

Re: NSInvocation question

2008-02-25 Thread Nir Soffer
On Feb 21, 2008, at 18:22, Hank Heijink wrote: I have a document-based application, and my NSDocument subclass runs an experiment which amounts to invoking NSInvocations based on certain conditions. These NSInvocations retain their arguments, and the target of the NSInvocation is the NSDocu

Re: NSInvocation question

2008-02-25 Thread Hank Heijink
That's essentially what I ended up doing: I need to save the other three instance variables of the MVActions, so for now I release the NSInvocation ivar before adding an MVAction to the array. Not very elegant maybe, but it does solve my problem. Thanks, Hank On Feb 25, 2008, at 3:30 PM, N

Re: NSInvocation question

2008-02-25 Thread Nir Soffer
On Feb 21, 2008, at 18:22, Hank Heijink wrote: I have a document-based application, and my NSDocument subclass runs an experiment which amounts to invoking NSInvocations based on certain conditions. These NSInvocations retain their arguments, and the target of the NSInvocation is the NSDoc

Re: NSInvocation question

2008-02-25 Thread Hank Heijink
On Feb 22, 2008, at 8:47 PM, Chris Suter wrote: On 23/02/2008, at 2:36 AM, Hank Heijink wrote: The nice thing about NSInvocation is not so much its efficiency (or lack thereof, as the case may be), but the fact that once you've got the thing constructed, you can just call invoke on it, wit

Re: NSInvocation question

2008-02-22 Thread Chris Suter
On 23/02/2008, at 2:36 AM, Hank Heijink wrote: The nice thing about NSInvocation is not so much its efficiency (or lack thereof, as the case may be), but the fact that once you've got the thing constructed, you can just call invoke on it, without having to think about what's inside. I have

Re: NSInvocation question

2008-02-22 Thread Hank Heijink
On Feb 21, 2008, at 11:18 PM, Chris Suter wrote: I'm not sure what exactly you're trying to do, but NSInvocation isn't that fast a way of making a call. It's certainly going to somewhat slower than a compiler generated call and it's not NSInvocation's intended use. I should have realized

Re: NSInvocation question

2008-02-21 Thread Nir Soffer
On Feb 21, 2008, at 18:22, Hank Heijink wrote: I have a document-based application, and my NSDocument subclass runs an experiment which amounts to invoking NSInvocations based on certain conditions. These NSInvocations retain their arguments, and the target of the NSInvocation is the NSDoc

Re: NSInvocation question

2008-02-21 Thread Chris Suter
On 22/02/2008, at 3:00 PM, Hank Heijink wrote: I made NSInvocations because timing is critical and I didn't want to spend the time constructing the call when it needs to be invoked. I haven't profiled the difference yet though, so maybe the tradeof isn't bad. I'll give it a whirl. I'm no

Re: NSInvocation question

2008-02-21 Thread Hank Heijink
On Feb 21, 2008, at 7:42 PM, Nir Soffer wrote: The problem I have is this: when I close my document, it isn't deallocated. If the invocations don't retain their arguments, that problem is gone, but I do need to retain them. What's a good way to solve this? I could release the NSInvocation