Fork me on GitHub
#cljfx
<
2022-04-11
>
acim120:04:10

I'm going to be manipulating (appending some text within) a control "behind the scenes" and I'm trying to figure out the nicest way to do this. For more detail, it will be an indirect chain where a user clicks on something, I read a file, and some text appears within a component the user was not directly interacting with. The answer in issue 41 here gives some hints: https://github.com/cljfx/cljfx/issues/41#issuecomment-640097217 Basically, I can snag a reference to the control using :on-created. Maybe I could try to (somehow) get a reference to the sibling component that is being clicked, and make the reference snagged in :on-created a listener...I'm not sure if that's feasible in cljfx or not. Tempted to just shove that snagged reference in an atom, but wondering if there is a cleaner way. FYI, this would be a text area (basically, it's actually a wrapped third-party https://javadoc.io/static/org.fxmisc.richtext/richtextfx/0.10.9/org/fxmisc/richtext/CodeArea.html) wanting to listen to the selection changes of a tree view, whereupon specific methods of this third party text area would be called.

vlaaad09:04:37

I would recommend using fx/make-ext-with-props and creating a custom prop that changes the code area driven by changes to state. And reading that file should put data into state that affects this new prop

👍 1