FROM : Shawn Erickson
DATE : Fri Apr 08 18:22:35 2005
On Apr 7, 2005, at 1:02 PM, Luc Vandal wrote:
> [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?
-Shawn
DATE : Fri Apr 08 18:22:35 2005
On Apr 7, 2005, at 1:02 PM, Luc Vandal wrote:
> [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?
-Shawn






Cocoa mail archive

