FROM : Luc Vandal
DATE : Fri Apr 08 18:29:45 2005
Basically there's a text field, check boxes, radio buttons and buttons.
Like I said, makeFirstResponder is called every time I tab through the
controls but the notification is only received once, when the window
has closed.
> [center addObserver:self
> selector:@selector(windowUpdated:)
> name:NSWindowDidUpdateNotification object:nil];
>
> - (void)windowUpdated:(NSNotification*)notification
> {
> NSResponder* resp = [[self window] firstResponder];
>
> if( resp != m_resp )
> {
> m_resp = resp;
> }
> }
>
> The only problem is that resp is always null. Where should I get the
> firstResponder instead?
You sure [self window] is returning a window reference and not nil?
Also is the window returned the active window (not sure without digging
in docs if firstResponder is expected return no nil for deactivated
windows, etc.)
What is self here, what class of object?
Actually that code is no good anymore...
On 8-Apr-05, at 12:18 PM, Shawn Erickson wrote:
>
> On Apr 8, 2005, at 9:06 AM, Luc Vandal wrote:
>
>> Hi!
>>
>> that seems to work great! However, I only get the notification once
>> the window has closed. Shouldn't I receive the notification every
>> time the first responder changes? makeFirstResponder is called every
>> time and sends the notification but the breakpoint I added in my
>> function is only triggered once...
>
> Can you explain what is in your window?
>
> -Shawn
DATE : Fri Apr 08 18:29:45 2005
Basically there's a text field, check boxes, radio buttons and buttons.
Like I said, makeFirstResponder is called every time I tab through the
controls but the notification is only received once, when the window
has closed.
> [center addObserver:self
> selector:@selector(windowUpdated:)
> name:NSWindowDidUpdateNotification object:nil];
>
> - (void)windowUpdated:(NSNotification*)notification
> {
> NSResponder* resp = [[self window] firstResponder];
>
> if( resp != m_resp )
> {
> m_resp = resp;
> }
> }
>
> The only problem is that resp is always null. Where should I get the
> firstResponder instead?
You sure [self window] is returning a window reference and not nil?
Also is the window returned the active window (not sure without digging
in docs if firstResponder is expected return no nil for deactivated
windows, etc.)
What is self here, what class of object?
Actually that code is no good anymore...
On 8-Apr-05, at 12:18 PM, Shawn Erickson wrote:
>
> On Apr 8, 2005, at 9:06 AM, Luc Vandal wrote:
>
>> Hi!
>>
>> that seems to work great! However, I only get the notification once
>> the window has closed. Shouldn't I receive the notification every
>> time the first responder changes? makeFirstResponder is called every
>> time and sends the notification but the breakpoint I added in my
>> function is only triggered once...
>
> Can you explain what is in your window?
>
> -Shawn






Cocoa mail archive

