Friday, August 7, 2020

#1 2019-11-17 11:33:53 am

SunnyFrinton
Member
Registered: 2012-09-13
Posts: 28

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]

Offline

 

#2 2019-11-18 12:21:46 am

technomorph
Member
Registered: 2017-12-14
Posts: 155

Re: setDoubleAction problem

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

That will trigger any selections that happen to iy

Offline

 

#3 2019-11-18 10:23:21 am

SunnyFrinton
Member
Registered: 2012-09-13
Posts: 28

Re: setDoubleAction problem

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.

Offline

 

#4 2020-01-29 07:37:35 pm

maro
Member
From:: Nerima, Tokyo, Japan
Registered: 2004-05-30
Posts: 118
Website

Re: setDoubleAction problem

Can we set "setDoubleAction" to NSButton object?


I wrote thousands of AppleScript to realize my idea. Natural language interface, voice recognition commander and so on. Though my mother toungue is strange language, Japanese, my most frequently write language is AppleScript. I believe it is for making things easy and powerful.

Offline

 

#5 2020-01-29 08:27:40 pm

maro
Member
From:: Nerima, Tokyo, Japan
Registered: 2004-05-30
Posts: 118
Website

Re: setDoubleAction problem

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

Applescript:


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....?


I wrote thousands of AppleScript to realize my idea. Natural language interface, voice recognition commander and so on. Though my mother toungue is strange language, Japanese, my most frequently write language is AppleScript. I believe it is for making things easy and powerful.

Offline

 

#6 2020-01-29 09:52:11 pm

maro
Member
From:: Nerima, Tokyo, Japan
Registered: 2004-05-30
Posts: 118
Website

Re: setDoubleAction problem

Applescript:


loc("click count", aCount)

Oh!!!!! It is my mistake!


I wrote thousands of AppleScript to realize my idea. Natural language interface, voice recognition commander and so on. Though my mother toungue is strange language, Japanese, my most frequently write language is AppleScript. I believe it is for making things easy and powerful.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)