[Mono-osx] NSKeyValueObserving with NSCollectionView

flohei flo at rootof.net
Tue Feb 8 10:02:34 EST 2011


Hi Miguel,

thanks for your reply. I just found an old article on your blog (http://monomac.wordpress.com/2010/12/07/key-value-coding/) which describes that. Though I'm now exporting the data source property in my WindowController and within the data source the properties it doesn't work for me. MonoMac keeps telling me (at runtime)

HIToolbox: ignoring exception '[<WindowController 0x3944b10> addObserver:<NSAutounbinderObservance 0x5b6590> forKeyPath:@"DataSource.Partners" options:0x0 context:0x5b2c80] was sent to an object that is not KVC-compliant for the "DataSource" property.' that raised inside Carbon event dispatch

This is how I do this in the WindowController

PartnerDataController dataSource;
		
[Export]
public PartnerDataController DataSource {
	get { return dataSource; }
}

and this is a part of the data source class

NSMutableDictionary [] partnerArray;
NSIndexSet selectionIndexes;

[Export]
public NSArray Partners {
	get {
		return NSArray.FromNSObjects(partnerArray);
	} set {
		partnerArray = NSArray.ArrayFromHandle<NSMutableDictionary>(value.Handle);
	}
}
		
[Export]
public NSIndexSet SelectionIndexes {
	get {
		return selectionIndexes;
	} set {
		selectionIndexes = value;
	}
}

In Interface Builder I have set the bindings to File's Owner's DataSource.Partners, etc.

–f

On 08.02.2011, at 15:48, Miguel de Icaza [via Mono] wrote:

> > I have a case where I create my own data source for a NSCollectionView. In 
> > plain Obj-C/Cocoa I would create a class adopting the NSKeyValueObserving 
> > Protocol to realize this. Unfortunately this class seems to be not 
> > implemented yet. How do you guys do this? 
> 
> All you need is to flag the various methods you want with the proper 
> [Export] value. 
> 
> See the MonoMac page for a couple of links to tutorials on doing this. 
> 
> Miguel 
> _______________________________________________ 
> Mono-osx mailing list 
> [hidden email] 
> http://lists.ximian.com/mailman/listinfo/mono-osx
> 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://mono.1490590.n4.nabble.com/NSKeyValueObserving-with-NSCollectionView-tp3275746p3276062.html
> To unsubscribe from NSKeyValueObserving with NSCollectionView, click here.


-- 
View this message in context: http://mono.1490590.n4.nabble.com/NSKeyValueObserving-with-NSCollectionView-tp3275746p3276086.html
Sent from the Mono - OSX mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20110208/40c8230e/attachment.html 


More information about the Mono-osx mailing list