[Pythonmac-SIG] [Pyobjc-dev] another tableview question

Bob Ippolito bob at redivi.com
Fri Jul 8 06:39:03 CEST 2005


On Jul 7, 2005, at 6:10 PM, Dethe Elza wrote:

>
> On 7-Jul-05, at 7:29 PM, Phil Christensen wrote:
>
>>     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.

Since the types are specified by an existing class in the runtime,  
you definitely don't need or want to specify something else.  The  
objc.selector(...) is actually breaking things, because you can't  
just pull type codes out of your ass and expect it to do the right  
thing.  'O' doesn't mean object, '@' does.

>> #################################
>>
>> 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 because you're using bogus type codes.  Don't use  
objc.selector unless you need to AND know what you're doing ;)

-bob



More information about the Pythonmac-SIG mailing list