Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSKeyValueObserverMBS class.
NSKeyValueObserverMBS.addObserver(keyPath as string, options as Integer = 5, context as Variant = nil)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 13.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
keyPath: The key path, relative to the receiver, of the property to observe. This value must not be nil.
options: A combination of the option constants that specifies what is included in observation notifications.
context: Arbitrary data that is passed to anObserver in observeValueForKeyPath.
This class holds a strong references to context and a weak reference to target.
Available in OS X v10.3 and later.
NSKeyValueObserverMBS.Constructor(TargetHandle as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 13.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Please pass the handle of the target Cocoa object.
Like NSWindowMBS.handle or CALayerMBS.
NSKeyValueObserverMBS.Destructor
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 13.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
NSKeyValueObserverMBS.removeObserver(keyPath as string, context as Variant = nil)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 13.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
keyPath: A key-path, relative to the receiver, for which observer is registered to receive KVO change notifications.
context: Arbitrary data that more specifically identifies the observer to be removed.
Examining the value in context you are able to determine precisely which addObserver method was used to create the observation relationship. When the same observer is registered for the same key-path multiple times, but with different context pointers, an application can determine specifically which object to stop observing.
The context object is only used in OS X v10.7 and later.
The items on this page are in the following plugins: MBS MacBase Plugin.