cljfx

https://github.com/cljfx/cljfx
jlmr 2020-01-12T09:07:28.006400Z

Hi @vlaaad, I hope you can excuse my continuous questions, because here is another one. I want to use full press-drag-release as described here: https://openjfx.io/javadoc/11/javafx.graphics/javafx/scene/input/MouseEvent.html. To do that I call (.. event getSource startFullDrag) in the event-handler for :on-drag-detected. This gives the following error: java.lang.IllegalStateException: Not on FX application thread; currentThread = clojure-agent-send-pool-5. Adding fx/on-fx-thread: (fx/on-fx-thread (.. event getSource startFullDrag)) leads to two different errors: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Delay and java.lang.IllegalStateException: Cannot start full drag outside of DRAG_DETECTED event handler. Hope you can help me figure this one out too!

vlaaad 2020-01-12T09:14:36.006500Z

Hmm, this seems like the same problem with async event handling

vlaaad 2020-01-12T09:16:42.006600Z

If you can use just a function for :on-drag-detected, go with it. I think :fx/sync on event won't help in this case because event will still be handled on different thread, it'll just block ui thread until that event is handled

vlaaad 2020-01-12T09:18:30.006700Z

Otherwise I would suggest just going with synchronous event handling @jlmr

vlaaad 2020-01-12T09:21:51.006800Z

You use fx/create-app, right? It always wires async handling, so I would suggest just copying it's code to your project and removing async wrapping — it's all composed of public API calls

jlmr 2020-01-12T09:42:07.007400Z

Thanks for the quick response. Just using a fn like this: (fn [event] (.. event getSource startFullDrag) seems to do the trick.