Strange issue with NSPanel @"visible" keypath & observeValueForKeyPath
Strange issue with NSPanel @"visible" keypath & observeValueForKeyPath
- Subject: Strange issue with NSPanel @"visible" keypath & observeValueForKeyPath
- From: vade <email@hidden>
- Date: Wed, 07 Sep 2011 20:58:07 -0400
Hello
I have an NSWindow, which my app controller is observing the value of @"visible" keypath, with the following line
[previewWindow addObserver:self forKeyPath:@"visible" options:NSKeyValueObservingOptionNew context:NULL];
Running my app, and triggering an IBAction that calls orderFront: on the panel
In 10.7, This works, I get a single "observation" that the key has changed. However, in 10.6.8, I get no notification what so ever.
Now, changing the call to makeKeyAndOrderFront, in 10.7, I get *three* notifications, saying its visible, its not visible, and finally, that it is visible. On 10.6.8, I get *two* observations; its visible, and then its not visible.
Whats going on here?
I was suggested to look into replacing observeValueForKey with a bind: toObject: etc method, and bind the @visible parameter. This works in 10.7, but again, 10.6.8 seems to ignore the @visible, or at least act on it oddly.
I have gist up on github with a summary. I am thoroughly confused, but expect a trivial oversight. Anyone care to clear this up for me?
I need to know *exactly* when a window is onscreen, because a background OpenGL drawing routine needs to know when it is safe to draw into the rendering view. If I render too early, I can possibly throw OpenGL errors.
https://gist.github.com/1202249
Thank you in advance for any insight to this issue._______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden