[Pythonmac-SIG] Getting None in KVC objectInKeyAtIndex_
David Hain
dhain+pythonmac at zognot.org
Sun Apr 12 21:18:09 CEST 2009
I'm trying to use bindings to hook up my model to an NSOutlineView,
and I'm attempting to use the countOf<Key>, objectIn<Key>AtIndex_
methods to do the KVC half. The problem I'm running into is that I'm
getting None for the index argument, and I can't figure out what to do
with that. The reference materials[1] say that the method corresponds
to the NSArray objectAtIndex: method, which takes an NSUInteger, but
doesn't mention anything about null or nil or whatever it is in objc-
land.
So the question is, is the view supposed to be giving me None for that
argument, or did I hook something up in IB (or elsewhere) incorrectly?
If None is expected, then how am I supposed to interpret that? What
should I return?
Here's a paraphrase of my model:
class Node(NSObject):
...
def countOfChildren(self):
return len(self.children)
def objectInChildrenAtIndex_(self, index):
return self.children[index]
If other information or code would be helpful, I'd be happy to provide
it. Thanks!
-David
[1]: http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/AccessorConventions.html
More information about the Pythonmac-SIG
mailing list