KVO detection of changes to selection in NSOpenPanel
KVO detection of changes to selection in NSOpenPanel
- Subject: KVO detection of changes to selection in NSOpenPanel
- From: Jonathan Taylor <email@hidden>
- Date: Mon, 20 Jul 2015 17:13:21 +0100
I’ve just noticed a glitch where my custom file preview box in an NSOpenPanel works fine on OS X 10.9.5 but does not get updated on 10.8.5. Specifically, I declare a dependency of my property on panel.filenames, panel.URL and panel.directoryURL (just to see if ANY of them fire), and none of them are getting prodded when the user changes the selected file/directory. Does anybody know if this is expected behaviour?
I did notice somewhere buried in here:
https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKitOlderNotes/#X10_9Notes
that it says (for OS X 10.9)
> Key Value Observation compliance was dramatically increased for public and some private properties of actual, non sandboxed NSOpen and Save panels, including keys affecting other values. For example, if the directory value changes on a save panel, this will cause a KVO notification to be emitted for the URL value as well as the directory value. Sandboxed NSOpen and Save Panels do not have the same level of KVO compliance.
This does make me wonder if I should perhaps not be surprised that my use of keyPathsAffectingValueForKey is not going well, although nothing in that statement seems to specifically preclude what I am doing from working on 10.8. Does anyone know if there’s any hope of my KVO approach working? The alternative seems to be to implement a delegate method for panelSelectionDidChange. Would that be the sensible way to deal with this, or is there a third and better way I should be using?
Cheers
Jonny
_______________________________________________
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