setDoubleAction problem

Can anybody help with a setDoubleAction problem. I have started an ApplescriptObjC project that displays a window containing a multiple column table. When I double click on the window it only ever gives me the first line of the table. If I double click on a line in the table that does not contain an entry the subsequent double click works perfectly. I’m not sure how much code to display here, any help would save my sanity!

[code]property theData : {}
property tempList : {}
property firstWindow : missing value
property secondWindow : missing value
property theArrayController : missing value
property lineTable : missing value

property theDate : missing value
property theType : missing value
property theCategory : missing value

on buildList(theRecord)
set end of tempList to {theDate:text item 1 of theRecord,theType:text item 2 of theRecord,theCategory:text item 3 of theRecord, theOriginator:text item 4 of theRecord,theDescription:text item 5 of theRecord, theReference:text item 6 of theRecord, theValue:text item 7 of theRecord,theStatus:text item 8 of theRecord} – build list of required elements for display
theArrayController’s removeObjects:(theArrayController’s arrangedObjects()) – remove previous display
tell theArrayController to addObjects_(tempList) – load new display
secondWindow’s orderOut_(me)
firstWindow’s makeKeyAndOrderFront_(me)
tell lineTable to setDoubleAction_(“displaySelection:”)
end bulidList_

on displaySelection_(sender)
set theSelection to theArrayController’s selectedObjects() as list

set theDate to theDate of item 1 of theSelection – extract individual elements
set theType to theType of item 1 of theSelection
set theCategory to theCategory of item 1 of theSelection
end displaySelection_[/code]

Did you drag the delegate outlet from
You tableView to your array controller?

That will trigger any selections that happen to iy

Thanks for reply, I must have checked every attribute and binding a hundred times. You suggested checking the array controller bindings, everything looked OK but noticed the ‘Selected Inserted Objects’ was ticked, unticked it and now everything works, not sure why but it does! Many thanks for pointing me in the right direction.

Can we set “setDoubleAction” to NSButton object?

I could make a subclass of NSButton to detect double click event with NSButton.


script DCButton
	property parent : class "NSButton"
	
	property acceptsFirstResponder : true
	property becomeFirstResponder : true
	
	property trackingArea : missing value
	
	
	on mouseDown:aEvent
		log {"mouse down event", aEvent}
		set aCount to (aEvent's clickCount())
		loc("click count", aCount)
		
		continue mouseDown:aEvent
	end mouseDown:
	
end script

This code returns

"mouse down event",
"NSEvent: type=LMouseDown loc=(791.516,645.664) time=41546.5 flags=0 win=0x600003e00400 winNum=3725 ctxt=0x0 evNum=5815 click=1 buttonNumber=0 pressure=1 deviceID:0x400000032dd993e subtype=NSEventSubtypeTouch"

But I can not get “click” (clickCount) value. Hmm…?


 loc("click count", aCount)

Oh!!! It is my mistake!