[MacRuby-devel] HotCocoa table_view and the doubleAction

John Shea johnmacshea at gmail.com
Wed Apr 1 06:16:43 PDT 2009


Hi Dave,

thanks for your answer.

On Apr 1, 2009, at 14:39 , Dave Baldwin wrote:

> I haven't had any problems using delegate methods. For example I do:
>
> 	@tableView.delegate = self
>
> and define a delegate method:
>
> 	def tableView (table, shouldEditTableColumn: c, row: r)
> 		false
> 	end

Thats the first thing I tried - but for the tableView(table,  
setObjectValue .. method which was not delegated to.

Unfortunately as it was the first one i tried (because i wanted to  
edit table fields) -  that sent me on a wild goose chase trying to  
figure out why the delegate was not working as it was in all of my non- 
hotcocoa code.

So thanks for pointing out that some of them are actually delegated to.

For me:


   #works
   def controlTextDidChange(notification)
       NSLog("controlTextDidChange #{notification.object}")
       NSLog(@mv_table_view.selectedRow.to_s)
   end

   #works
   def tableView(tv, willDisplayCell:cell, forTableColumn:col,  
row:the_row)
    NSLog("willDisplayCell")
   end

   #works
   def tableViewSelectionDidChange(notification)
     NSLog("tableViewSelectionDidChange")
   end

#is not delegated to
   def tableView(tv, setObjectValue:anObject, forTableColumn:col,  
row:row)
     NSLog("tableView setObject")
     #edit data here
   end

#is not delegated to
   def numberOfRowsInTableView(tv)
     NSLog("numberOfRowsInTableView")
     0 #test 0
   end

#is not delegated to
   def tableView(tv, objectValueForTableColumn:col, row:row)
     NSLog("objectValueForTableColumn")
     val = "richard"
   end


I could probably do a work around with controlTextDidChange - but it  
seems a bit dodgy.
Or another option would be to edit not within the table, but in  
another form.

I suppose there is some simple explanation - but I am missing it for  
the moment.

Cheers,
J






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20090401/5caaeda6/attachment.html>


More information about the MacRuby-devel mailing list