On 7-Jul-05, at 7:29 PM, Phil Christensen wrote:
> ################################# > # class defined in MainMenu.nib > class ContentsTreeViewDelegate(NibClassBuilder.AutoBaseClass): > # the actual base class is NSObject > # The following outlets are added to the class: > # controller > # tableView > > def init(self): > self.contents = [] > return self > You should call your superclass init() here. Bob Ippolito wrote about proper use of super on this list a few days ago, so I'm paraphrasing from him: def init(self): self = super(ontentsTreeViewDelegate, self).init() self.contents = [] return self > def awakeFromNib(self): > self.tableView.documentView().setDataSource_(self) > You can (and perhaps should) set the data source in your nib using InterfaceBuilder. > def numberOfRowsInTableView_(self, sender): > return (len(self.contents)) > numberOfRowsInTableView_ = objc.selector(numberOfRowsInTableView_, > argumentTypes='O', > returnType='i') > I have never needed to use objc.selector. I think this method should be OK without it. > def tableView_objectValueForTableColumn_row_(self, sender, > tableColumn, row): > if (len(self.contents) > row): > self.contents[row] > tableView_objectValueForTableColumn_row_ = objc.selector > (tableView_objectValueForTableColumn_row_, > > argumentTypes='OOi', > > returnType='O') > I think this may be the problem, you're not returning a value from this method. Also, the value you return should inherit from NSObject, and you should keep a reference to it, because the tableView doesn't, IIRC. > ################################# > > but when I run the application I get: > > 2005-07-07 22:19:30.911 controller[7740] *** Illegal NSTableView > data source (<ContentsTreeViewDelegate: 0x11ac760>). Must > implement numberOfRowsInTableView: and > tableView:objectValueForTableColumn:row: > I think this is due to you not returning a value from the method above. Try it and see. > > Which I thought I had! Incidentally, I've also tried defining the > selector with and without the 'selector' argument, and I've also > tried using the 'signature' argument instead of the argumentTypes/ > returnType keywords. > You shouldn't need these, the PyObjC does a great job of hiding these details. > Any help would be greatly appreciated. > > Thanks in advance, > > -phil christensen > [EMAIL PROTECTED] > --Dethe Windows has detected the mouse has moved. Please restart your system for changes to take effect. _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig