cljfx

https://github.com/cljfx/cljfx
thom 2021-06-22T20:31:41.006Z

How might one manage dynamic resizing of controls with cljfx? I see various JavaFX examples using bind which I don't think is exposed, but are width/height properties magically wrapped in event handlers somehow? I would happily use a border pane or similar, but ideally I'd be able to spot changes in a parent container's dimensions and use those to scale JavaFX shapes, which aren't resizeable like other controls.

thom 2021-06-24T10:21:37.008800Z

This worked out really nicely btw, even ended up using the sub-ctx stuff to subscribe to the changing width/height and work out the aspect fit for another component. Thanks for the pointers!

👍 1
vlaaad 2021-06-22T20:51:32.006500Z

hmm, it looks like you will need to create an extra-props lifecycle (`make-ext-with-props`) that will add on-width-changed/on-height-changed event listeners to your containers

vlaaad 2021-06-22T20:54:32.006700Z

something along the lines of (fx/make-ext-with-props {:on-width-changed (fx.prop/make (fx.mutator/property-change-listener #(.widthProperty %)) fx.lifecycle/change-listener) ...})

thom 2021-06-22T20:55:26.007Z

nice, will dig into that. ta!

thom 2021-06-22T21:19:03.007200Z

ah, good example in e34_web_browser.clj which I missed, apologies. This method works though, thanks!