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!
Hmm, this seems like the same problem with async event handling
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
Otherwise I would suggest just going with synchronous event handling @jlmr
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
Thanks for the quick response. Just using a fn like this: (fn [event] (.. event getSource startFullDrag)
seems to do the trick.