clojure-android / neko

The Clojure/Android Toolkit
Other
297 stars 36 forks source link

The listener on-editor-action has no respective trait #51

Closed Malabarba closed 9 years ago

Malabarba commented 9 years ago

If I specify a :on-editor-action in a text-view's map like the following, I get an exception saying there's no such method .setOnEditorAction.

[:edit-text {:on-editor-action
                 (fn [view _action _event] ...)}]

I tried :on-editor-action-listener, but I get the same problem.

Malabarba commented 9 years ago

I was going to implement this and make a PR, but I see now it's already implemented in traits.clj. But there's on caveat, its arglis has 2 arguments, whereas the arglist of other :on-X traits take 3 arguments. Could that be the cause of thebug?

alexander-yakushev commented 9 years ago

The number of arguments to the function is equal to the number of arguments the Listener object takes. The fact that other :on-x traits take other number of arguments is incidental, there is no rule there, every handler is unique.

alexander-yakushev commented 9 years ago

Yeah, I also found the previous issue: #26.

Malabarba commented 9 years ago

The number of arguments to the function is equal to the number of arguments the Listener object takes.

Really? I'm not refering to the arglist of the callback function, but the following argvector [^TextView wdg, {:keys [on-editor-action]}]. If this has to be equal to the number of arguments of the listener object, shouldn't that be 3 then?

alexander-yakushev commented 9 years ago

You are right, that is a bug. I will fix it in the nearest version.

alexander-yakushev commented 9 years ago

So this was already fixed in 722b4b010261818fb7fe0ec83e7016dd74e1cd07 :balloon: