FROM : Ron Fleckner
DATE : Wed Feb 06 11:33:39 2008
On 06/02/2008, at 7:37 PM, Pierre Bernard wrote:
> OK, I figured out how to add a timer. Unfortunately, that does not
> help with my problem of the misbehaving field editor.
>
> - (void)viewDidMoveToWindow
> {
> [super viewDidMoveToWindow];
>
> self.focusTimer = [NSTimer timerWithTimeInterval:1.0
> target:self
> selector:@selector(focusOnSearchField)
> userInfo:nil
> repeats:NO];
>
> [[NSRunLoop currentRunLoop] addTimer:self.focusTimer
> forMode:NSEventTrackingRunLoopMode];
> }
>
> - (void)focusOnSearchField
> {
> [[self window] makeFirstResponder:searchField];
>
> [self.focusTimer invalidate];
> self.focusTimer = nil;
> }
>
> Pierre
Hi,
not having Leopard I could be just adding noise, but...
Shouldn't your timer's selector method's signature be - (void)
focusOnSearchField:(NSTimer *)aTimer ?? That is, the timer should be
the argument to the method.
From the (Tiger) docs:
Discussion
After seconds have elapsed, the timer fires, sending the message
aSelector to target. The aSelector method has the following syntax:
- (void)myTimerFireMethod:(NSTimer*)theTimer
The timer passes itself as the argument to aSelector... [and more
deleted]
HTH,
Ron
DATE : Wed Feb 06 11:33:39 2008
On 06/02/2008, at 7:37 PM, Pierre Bernard wrote:
> OK, I figured out how to add a timer. Unfortunately, that does not
> help with my problem of the misbehaving field editor.
>
> - (void)viewDidMoveToWindow
> {
> [super viewDidMoveToWindow];
>
> self.focusTimer = [NSTimer timerWithTimeInterval:1.0
> target:self
> selector:@selector(focusOnSearchField)
> userInfo:nil
> repeats:NO];
>
> [[NSRunLoop currentRunLoop] addTimer:self.focusTimer
> forMode:NSEventTrackingRunLoopMode];
> }
>
> - (void)focusOnSearchField
> {
> [[self window] makeFirstResponder:searchField];
>
> [self.focusTimer invalidate];
> self.focusTimer = nil;
> }
>
> Pierre
Hi,
not having Leopard I could be just adding noise, but...
Shouldn't your timer's selector method's signature be - (void)
focusOnSearchField:(NSTimer *)aTimer ?? That is, the timer should be
the argument to the method.
From the (Tiger) docs:
Discussion
After seconds have elapsed, the timer fires, sending the message
aSelector to target. The aSelector method has the following syntax:
- (void)myTimerFireMethod:(NSTimer*)theTimer
The timer passes itself as the argument to aSelector... [and more
deleted]
HTH,
Ron
| Related mails | Author | Date |
|---|---|---|
| Hendrik Holtmann | Jan 4, 15:20 | |
| Peter Ammon | Jan 4, 21:30 | |
| Pierre Bernard | Feb 6, 00:43 | |
| Pierre Bernard | Feb 6, 09:37 | |
| Ron Fleckner | Feb 6, 11:33 | |
| Pierre Bernard | Feb 6, 11:38 | |
| Lieven Dekeyser | Feb 15, 13:55 |






Cocoa mail archive

