[MacRuby-devel] HotCocoa table_view and the doubleAction

John Shea johnmacshea at gmail.com
Wed Apr 1 02:58:48 PDT 2009


Hi Dave,

I am actually wrestling with a similar problem.

  I believe I have solved your problem, maybe you can solve mine ;-) ??

in the start method I placed:
       @my_table_view.setTarget(self)
       @my_table_view.setDoubleAction(:double)


and then later on a method:

   def double
     NSLog ("double")
   end


My issue is also delegating table updates to certain methods.

I noticed that tableview.setDelegate(self) did not do anything - and  
then I assumed that the TableDataSource is actually handling the  
delegate  - confirmed when I changed the numberOfRowsInTableView  
method to return the value 1.

But then I assume that I am not supposed to add my own tableView(tv,  
setObjectValue:anObject, forTableColumn:col, row:row) method to the  
HotCocoa TableDataSource file?

What happens if I have two tables in the one application with  
different delegated behaviour?

Am I supposed to get funky and add the different versions of the  
tableView methods to the data instance itself?
Is there a way to override the delegate dispatch to actually go a  
local class?

or do I setActions like in the double clicked example above?

Cheers and thanks,
J







On Apr 1, 2009, at 11:33 , Dave Baldwin wrote:

> I am having some difficulty on getting the double click action to  
> work with a table view.  I have code along the lines of:
>
>
> 		@tableView = table_view(
> 					:columns => [column(:id => :item, :title => '')],
> 					:data => @filteredData
> 				)
>
>
> 		@tableView.doubleAction = 'doubleClickInRow:'
>
> 		def @tableView.doubleClickInRow (sender)
> 			NSLog "in double click"
> 		end
>
> When I run and double click on a row in the table I get:
>
> *** -[RBAnonymous132 doubleClickInRow:]: unrecognized selector sent  
> to instance 0x8005d1c40
>
>
> Does anyone know how to get this to work?
>
> Thanks,
>
> Dave.
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



More information about the MacRuby-devel mailing list