Re: NSTimer and a problem with document-based apps

2008-07-28 Thread Sumner Trammell
Thanks guys. Using class methods was a brilliant idea. Solidified my understanding of when I might want to use them, and when I might want to use @synchronized as well. -s On Sat, Jul 26, 2008 at 7:30 PM, Todd Heberlein <[EMAIL PROTECTED]> wrote: >> - (id)init { >> ... >> timer = [NSTimer schedu

Re: NSTimer and a problem with document-based apps

2008-07-26 Thread Todd Heberlein
- (id)init { ... timer = [NSTimer scheduledTimerWithTimeInterval:10.0 ... } ... That new instance of course calls init, and suddenly I have two NSTimers running when I only wanted one timer for the whole app. I think you want to make your timer a global variable and then initialize it wi

Re: NSTimer and a problem with document-based apps

2008-07-26 Thread Clark Cox
On Sat, Jul 26, 2008 at 3:34 PM, Sumner Trammell <[EMAIL PROTECTED]> wrote: > Hi. I'm writing a Cocoa document-based app (using the Xcode template) that > uses a WebView and needs an NSTimer to trigger one of the methods every 10 > seconds in the MyDocument class. It sounds like you want a single

NSTimer and a problem with document-based apps

2008-07-26 Thread Sumner Trammell
Hi. I'm writing a Cocoa document-based app (using the Xcode template) that uses a WebView and needs an NSTimer to trigger one of the methods every 10 seconds in the MyDocument class. In my init method, I set up the timer: @interface MyDocument : NSDocument { IBOutlet WebView *webView; NSTimer